Aggressive NTP configuration on Windows 10

Screenshot of time.is in Esperanto

While clicking around on time.is, which has a nice Esperanto translation that you may want to to check out, I kept running into large-ish time offsets of at least several tenths of a second on a Windows 10 machine.

As a Linux guy, my first instinct was to replace the interval-based synchronization option in Windows with an NTP daemon, and so I found Meinberg’s ntpd distribution for Windows. While this ntpd would start flawlessly, over the course of every day it ran into some impossible to debug condition where NTP time reached a significant offset from the system clock again and unlike at startup, the daemon wouldn’t adjust the system clock anymore.

So I turned back to Windows’ built-in time synchronization. Indeed, the people at Meinberg also have helpful advice for it and suggest a few defaults to keep the system clock closely tied to an NTP reference clock. So here’s an attempt at configuring a clean NTP setup on Windows 10.

First of all, the timekeeping service needs to be stopped and fortunately Windows 10 provides the ability to start over with a fresh timekeeping configuration (all following actions must be applied using an administrator role):

net stop w32time
w32tm /unregister
w32tm /register

At this point, the defaults as suggested by Meinberg can be added to the registry:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config]
"FrequencyCorrectRate"=dword:00000002
"MaxPollInterval"=dword:00000006
"MinPollInterval"=dword:00000006
"UpdateInterval"=dword:00000064

Finally, a restart of the timekeeping service and configuration of the NTP reference clocks:

net start w32time
sc config w32time start=auto
w32tm /config /syncfromflags:manual /manualpeerlist:"0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org 3.pool.ntp.org" /update

NTP synchronization status can be queried using the w32tm command again:

w32tm /query /peers
w32tm /query /status /verbose

In my highly scientific observation of the system, I haven’t seen any clock offsets ever since.

Further reading: “Windows Time Service Tools and Settings” by Microsoft.

2 thoughts on “Aggressive NTP configuration on Windows 10”

  1. Thanks for this. This is eyeopener. Below I see “out of valid range” does it makes sense?
    Peer: 3.pool.ntp.org
    State: Active
    Time Remaining: 13.8077394s
    Mode: 3 (Client)
    Stratum: 2 (secondary reference – syncd by (S)NTP)
    PeerPoll Interval: 17 (out of valid range)
    HostPoll Interval: 6 (64s)
    Last Successful Sync Time: 23/12/2019 21:32:21
    LastSyncError: 0x00000000 (Succeeded)
    LastSyncErrorMsgId: 0x00000000 (Succeeded)
    AuthTypeMsgId: 0x0000005A (NoAuth )
    Resolve Attempts: 0
    ValidDataCounter: 1
    Reachability: 3

Comments are closed.