[ntp:questions] How to control accuracy of GetSystemTimeAsFileTime?
david at ex.djwhome.demon.co.uk.invalid
Wed May 13 20:33:20 UTC 2009
johumohu at yahoo.com wrote:
> The theoretical precision of GetSystemTimeAsFileTime() or equivalent
> procs is 100 nanoseconds. However my tests show the accuracy is
The is what I meant by the architectural limit in another current thread.
> 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.
You could have mentioned this earlier. No version of Windows is
optimised for precision timing.
> 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
The updates are always one tick; the length of a tick varies.
> with power management because these cases seem to happen when there is
The most well known reason for this is multi-media timers. The clock is
run at up to 1kHz, so as to meet the tightest multi-media timing
requirements of any running application. ntpd forces multimedia timers
to their fastest, as there can be phase artifacts when rates change. If
you are using ntpd, rather than w32time, and this is not happening,
please raise a bug report.
One caution, in the past there have been reports of losing ticks because
of, in particular, disk drivers disabling interrupts for more than 1ms.
It is possible that this problem no longer exists.
> 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?
The easiest way, if you are concerned about accurate timing, is probably
to run ntpd.
More information about the questions