Running on Windows7 64bit machine with a very powerful CPU (8 core 16 threads). I used a QTimer to trigger a function call at 50Hz. But I ended up with 30Hz. The function call itself definitely takes less than 10ms to finish. The whole process happens in a separate thread.
What could go wrong in my case? The Qt's doc said it will be accurate within 5%?
You can achieve a better timer precision by setting timer type property to Qt::PreciseTimer
(the default type is Qt::CoarseTimer
).
From the docs:
Qt::PreciseTimer
– Precise timers try to keep millisecond accuracy.Qt::CoarseTimer
– Coarse timers try to keep accuracy within 5% of the desired interval.
However, as pointed out by @Paul and @AlgirdasPreidžius, there is still no guarantee that the precision will be perfectly accurate.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With