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

Dave Hart davehart at gmail.com
Thu Jan 21 14:18:07 UTC 2010


On Thu, Jan 21, 2010 at 11:01 UTC, Martin Burnicki wrote:
> Dave Hart, isn't there a way to force disabling time interpolation with your
> binaries even if the system time increments in 15.625 ms steps?

No, the opposite is available (forcing its use on), but the only way
to disable interpolation is to use ntpd -M on Windows Vista or newer,
where after cranking the multimedia timer to highest resolution, ntpd
will notice the system clock is stepping in less than 4ms increments
and disable interpolation:

if (os_clock_precision < 4 * 10000 && !getenv("NTPD_USE_INTERP_DANGEROUS")) {
	msyslog(LOG_INFO, "using Windows clock directly");
} else {
	winnt_use_interpolation = TRUE;

It is interesting to me that the brokenness is the same on 4.2.4p8
(which has the old Windows interpolation code) and 4.2.6 (which has
the new interpolation introduced around 4.2.5p162).  Both codebases
are trying to do the same thing, maintain a mapping between the
performance counter timeline and the system clock timeline.  Since
both are equally hosed, I am relieved to believe it's not indicating a
problem with the new interpolation code.

Although it's a longshot, you can try forcing ntpd to use the
processor TSC instead of QueryPerformanceCounter.  To do this, you
need to determine your processor frequency very accurately (and I
can't point to a good tool for that offhand).  Then add --pccfreq=X
where X is your processor frequency in Hz.  For a nominally 400MHz
space heater of mine, the magic value is --pccfreq=398125000.  If you
don't get this within a few PPM of the correct figure, expect ntpd to
go wild immediately.  If your TSC rate (CPU frequency essentially)
varies over time, it will break this config.  When using the TSC (PCC)
instead of QueryPerformanceCounter, ntpd 4.2.6 will automatically lock
thread affinity to a single processor for threads which use the
counter.

Cheers,
Dave Hart




More information about the questions mailing list