Even though the QTimer docs says they are 1 ms accurate, that's partially true, because QTimers are depending on other tasks in your application. For fun you can add a few 1000 qtimers, and plot the time for each of them to see what wysota is talking about. (Or find something that maxes your cpu usage while using qtimers in another program...)
You can use QDateTime and get the milliseconds timer to do a better timing. for instance if you need 40ms timing, set the timer to something faster than 40 ms and use the milliseconds from qdatetime to trigger en event at exactly 40ms from last time. (just save your last-time somewhere...) Although this is not a particullary good solution..
I suggest reading this article covering the subject with some data and tests:
The Qt Framework and (soft) real-time projects
Short summary is in win32, use win32 native periodic timer, on linux, use RTC wait.
you also might want to run your timing in a seperate thread/process...
cheers,
leif
Bookmarks