[time-nuts] NTP and Windows 7

Martin Burnicki martin.burnicki at burnicki.net
Thu Mar 27 13:42:12 EDT 2014


John Nelson wrote:
> Greetings from Wales. I'm not sure whether this august forum is the
> appropriate place to ask a question about PC timekeeping, but in the hope
> that someone can point me in the right direction I'll ask anyway ;-)
>
> I have just replaced Windows XP with Windows 7. The PC involved (a fairly
> elderly 2.4GHz Core2 machine) runs an application called 'PlanePlotter'
> which requires accurate timekeeping and mandates Meinberg's NTP software.
> Using the UK pool.ntp.org servers as a reference source this has worked very
> well under XP for several years and the clock was seldom more than a few
> milliseconds out. Under Windows 7, however, the clock can be anything up to
> 0.2s awry and the offset is very erratic. The daily loopstats graph looks
> like a section through a mountain range.
>
> I have carefully checked all settings and combed the internet for
> suggestions but can see no reason for the sharply degraded performance. Is
> there something about Windows 7 that degrades the performance of NTP? Or is
> there anything subtle I can check?

The latest Windows bug which came to our attention is that some Windows 
versions don't apply small time adjustments at all. For example, if NTP 
applies an adjustment less than 16 ticks to the Windows time this is 
simply ignored by Windows. However, NTP expects the adjustment to have 
some effect, but if there is no effect then the next time comparison 
yields a much larger difference than expected, and thus causes another 
adjustment which is probably larger than necessary. As a summary this 
can cause large swings in the time adjustment values.

A developer version of the NTP package contains a workaround for this 
Windows bug. The report and fix are discussed here:

NTP Bug 2328 - Vista/Win7 time keeping inaccurate and erratic
https://bugs.ntp.org/show_bug.cgi?id=2328

The problem is also explained on the Microsoft support page:

SetSystemTimeAdjustment May Lose Adjustments Less than 16
http://support.microsoft.com/kb/2537623

Even though the MS report only mentions Windows 7, the Windows Server 
2008 kernel is similar to Windows 7 and has probably the same bug. So if 
you want to give it a try you can download a NTP developer version here 
which includes a workaround:
http://people.ntp.org/burnicki/windows/

(The latest ntp-dev version also contains this fix, so alternatively you 
can use that one, as siuggested by David Taylor)

You should try the release version first. Just unzip the ZIP archive, 
stop the NTP service, copy all extracted files over the files in your 
NTP installation directory (e.g. C:\Program Files (x86)\NTP\bin\), and 
restart the NTP service.


We have found that this version has greatly improved the resulting 
accuracy on Windows 7 and Windows Server 2008 installations.

Please note under Windows you should configure all upstream servers with 
a line reading

server aa.bb.cc.dd iburst minpoll 6 maxpoll 6

where aa.bb.cc.dd has to be replaced with the host name or IP address of 
your NTP server.

Generally you should use a polling interval as short as possible under 
windows to let let ntpd apply adjustments quickly.

However, please don't use polling intervals below 6 with the developer 
version since this prevents the workaround from working correctly as 
discussed in the bug report.

Also, higher polling intervals can cause problems under Windows. See:

NTP Bug 2341 - ntpd fails to keep up with clock drift at poll > 7
http://bugs.ntp.org/show_bug.cgi?id=2341

So our advice is to use "minpoll 6 maxpoll 6" as indicated in the 
example above.

The patched ntpd has caused no drawbacks on any Windows machines, but 
has improved accuracy on a number of installations.

The directory
http://people.ntp.org/burnicki/windows/
contains also some loopstats graphs as PDF files which show the improvement:
http://people.ntp.org/burnicki/windows/bug2328_workaround.pdf
http://people.ntp.org/burnicki/windows/bug2328_workaround_fine.pdf

Martin



More information about the time-nuts mailing list