Perm Timer Precision

Post Reply
Jor'Mox
Posts: 1146
Joined: Wed Apr 03, 2013 2:19 am

Perm Timer Precision

Post by Jor'Mox »

If I have a permanent timer firing every 1/10 of a second or so, about how accurate should I expect it to be in the long term, compared to a real clock? Am I looking at losing a few seconds every minute or so, or will it be pretty close for longer periods? Also, is that accuracy going to be system dependent, or fairly consistent on relatively modern computers?

Thanks!

User avatar
chris
Posts: 493
Joined: Fri Jun 17, 2011 5:39 am

Re: Perm Timer Precision

Post by chris »

It's a QTimer. Here's some info on it (https://qt-project.org/forums/viewthread/32970 and http://qt-project.org/doc/qt-5.1/qtcore ... rType-enum). We don't specify any timer type, and the default isn't documented so I have no idea what it is.

Jor'Mox
Posts: 1146
Joined: Wed Apr 03, 2013 2:19 am

Re: Perm Timer Precision

Post by Jor'Mox »

So, I did a bit of digging in regards to Qtimers, and learned the following:

Timers of 20 ms or less will use high precision timers (error 1 ms or less).
Timers of 20 s or more will use low precision timers (error of up to 1 s).
Timers in the middle will have an error of up to 5%, and their wake times will be driven toward multiples of the timer length (but only if the timer length is itself a multiple of 50 ms).

Post Reply