[ntp:questions] How to control accuracy of GetSystemTimeAsFileTime?

Unruh unruh-spam at physics.ubc.ca
Thu May 14 16:32:47 UTC 2009

johumohu at yahoo.com writes:

>The theoretical precision of  GetSystemTimeAsFileTime() or equivalent
>procs is 100 nanoseconds. However my tests show the accuracy is

No, that is the number of decimal points that are representable by the
variable used. That does NOT represent the accuracy of the time as you
discovered. SystemTime has a maximum precision of 1ms, and simply
converting it to a format which could represent a more precise result
doe nothing for the accuracy of th time. 

>minimum 1 millisecond and all updates are done in multiples of 1
>millisecond. I ran the tests on a new consumer-type PC desktop (quad
>processor)  and a new consumer-type laptop (dual processor), both with
>Vista, the test results were similar on both.

That is apparently a limitation of Windows. They report System time to a
precision of 1 ms, but an accuracy of 1ms, or even 15 ms depending on
how you set up your system.

>Normally, the system time count is updated every 1 millisecond, but
>there are some long intervals when the system time is updated
>consistently every 16 milliseconds (one tick). I suspect it has to do
>with power management because these cases seem to happen when there is
>no input through the keyboard or mouse for extended period of time. My
>power management is configured to NEVER put processor to sleep, and I
>have not seen any other power managament parameter related to this

>Does anybody know how to force the system time to be updated every 1
>millisecond? What to check for?

More information about the questions mailing list