[ntp:questions] Timekeeping broken on Windows XP with multimedia timer enabled (-M option)

Martin Burnicki martin.burnicki at meinberg.de
Thu Jan 21 14:51:23 UTC 2010


Alan wrote:
> I'll try a few experiments. Motherboard is ASRock ALiveNF6p-VSTA, a
> fairly mainstream manufacturer board with NVIDIA Chipset and onboard
> graphics. That or very similar architecture boards are quite widely in
> use.
> 
> I do have a copy of OpenSolaris I stuck on another partition to play
> with some time ago so I can install NTPD on it and watch what happens
> when I get a chance.

Remember whether timekeeping works correctly depends at least on:

- which timer circuit is being used
- whether that timer hardware works correctly or not
- whether that timer is handled correctly by the OS, or not

so it's possible OpenSolaris is a perfect timekeeper on that board.

> Might also try a fresh install of Windows on 
> another parition to see if I still see the problem.
> 
> In the meantime what I've noticed is that if I fire up most multimedia
> apps (web browser plugins for example) then the timer resolution gets
> set to 1.953 ms or 3.906 ms and in this case NTPD DOES MANAGE TO SYNCH
> THE TIME!! (although it drifts a bit before resynching) It seems that it
> is only when the timer interval drops to 0.977 ms either set by NTPD or
> something else (Windows Media player sets it to this for example) that
> we enter a time-warp.
> 
> So in  summary
> 
> Current timer interval: 15.625 ms - No problem
> Current timer interval   3.906 ms - No problem
> Current timer interval   1.953 ms - No problem
> Current timer interval   0.977 ms - Wild time drift

AFAIK the MM timer resolution can be set in 1 ms steps, so the nominal
values for what you've observed should be 4 ms, 2 ms, and 1 ms.

I have not yet had a closer look at the clockres tool from sysinternals
mentioned by Evandro Menezes, but that program just seems to count the MM
timer callbacks during a 15.625 ms system time interval, or vice-versa. See
this computation:

15.625 ms / 16 = 0.97656 ms

clockres shows the same 0.977 ms interval on a Win XP SP3 system here when
ntpd is running with -M. This system has a AMD Athlon 64 X2 4400+ CPU and
ntpd is working fine.

Here are a few thoughts I've also already posted some time ago, see:
http://lists.ntp.org/pipermail/questions/2009-December/025210.html

> Even if under Vista/Windows 7 the system time increments in 1 ms steps, 
> the nominal standard tick count is still ~15600 (15601 on a Vista machine
> here), i.e ~15.6 ms. Since this is not an integral multiple of 1 ms there
> must be some math which converts from 1 ms steps to 15.6 ms steps, and
> that math may suffer from rounding errors.
> 
> AFAICS this is still the basic problem as under XP or earlier, when the MM
> timer has been set: The MM timer ticks at 1 ms, but the system time ticks
> at 15.625 ms, and there also needs to be a conversion from one tick rate
> to the other.
> 
> The difference in Vista/7 vs. 2000/XP seems to be that
> GetSystemTimeAsFiletime returns values from the 1 ms "tick domain" for the
> newer systems whereas it returns values from the 15 ms "tick domain" on
> older systems.

Martin
-- 
Martin Burnicki

Meinberg Funkuhren
Bad Pyrmont
Germany




More information about the questions mailing list