[Interest] QTimer and Qt::PreciseTimer

Joshua Grauman jnfo-c at grauman.com
Wed Jul 26 21:58:43 CEST 2017


Hello all,

I have a QTimer in my application that runs every 40ms. It doesn't run 
continuously, but I recall the start function every time my timer function 
is done so that the timer doesn't drift over time. My question though is 
about timeout overrun. If the system is busy, and so the timer is late, 
will Qt::PreciseTimer be more likely to return on time than 
Qt::CoarseTimer? In other words, I'm ok with the 5% accuracy of 
Qt::CoarseTimer normally (when the system isn't busy), but when the 40ms 
timer is getting close to 60ms, I want to avoid timer overrun.

Does anyone have any more precise info about Qt::PreciseTimer than the 
docs which say:

"All timer types may time out later than expected if the system is busy 
or unable to provide the requested accuracy. In such a case of timeout 
overrun, Qt will emit activated() only once, even if multiple timeouts 
have expired, and then will resume the original interval."

Thanks!

Josh



More information about the Interest mailing list