Synchronizing machines to the High Precision Clock
Starting from Windows10 (build) window's System Time can be synchronized to a High Precision Time Source that uses PTP (Precision Time Protocol). PTP is more precise than NTP (Network Time Protocol), which is used in Windows by default to sync its time.
Overview
There needs to be at least one PTP Source in your LAN Network. In case there are multiple, they agree among each other who the Grandmaster is.
Configure Windows as a PTP client
Configuring PTP on the system takes several steps:
- Make sure the system has this dll:
C:\Windows\System32\ptpprov.dll. - Check if one of the systems LAN cards (Wi-Fi won't work) support PTP:
- Navigate to
View Network Connections > Right Click > Properties > Configure > Advanced. - Look for
PTP Protocol Timestampand enable it. Some network cards don't support it at all. - If the system has multiple cards, the one with PTP Enabled must be assigned as the preffered one, in order to be picked by the time service: In the
Propertiesof the Network Adapter:Internet Protocol Version 4 (TCP/IPv4) > Properties > Advancedturn offAutomatic metricand set it to a value, smaller than for the other cards.
- Navigate to
- Run registry file (link) to set several keys:
- A key
PtpClient(Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\w32time\TimeProviders\PtpClient) with some subkeys is added, as described here. Note, you have to setPtpMasterskey to the IP(s) of your ptp time providers. - Some subkeys under a
Configkey (Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\w32time\TimeProviders\Config) are updated, as described in Configuring Systems for High Accuracy. - The NtpClient will be disabled, only PtpClient remains enabled.
- A key
- Enable Inbound and Outbound UDP Ports 319 and 320 in Windows Firewall. These are used by the PTP protocol.
When the configuration is ready:
- Start
Command Lineas Adminitrator - Restart the time service:
net stop w32time && net start w32time - Make sure that the service starts automatically on start (check
System Services) - Run
w32tm /query /configuration, you should see PtPClient in the list - Run
w32tm /query /status /verboseto see the status of the sync. IfSourcesaysLocal CMOS Clockthe system doesn't yet sync to PTP.
It takes some time until the client and server have negotiated a sync. Checking w32tm /query /status /verbose will give you hints how many seconds ago the system was synced etc.
For more about Windows Time Service:
Configuration of a Server (Ptp Time Source)
Although there are special hardware PTP Sources, PTP Source Service can run from on a simple Raspberry Pi 5 (Network Card on the earlier versions doesn't support PTP). And if a real high precision time is needed, a GPS receiver could be added to the Raspberry Pi.
These articles describe how to setup and run PTP Service on Linux: