Search code examples
qtqtimer

How to know QTimer time since start value?


How to know QTimer time since start value ?

timer->interval() : this method is not counting.

I need about timer since start counting value.

please help me.


Solution

  • Use the QElapsedTimer as suggested by aghilpro. It provides the elapsed() function, which gives you want you want I assume. If that is not an option for your project and you are forced to used QTimer, you can use interval() and substract remainingTime(). Make sure the timer is active, otherwise you'll get garbage from that calculation.