The commands behind Time 1: Accuracy of NTP, chrony and w32time and Time 2: Data centres and clouds.
Configuring a domain
Run these from an elevated prompt.
| Command | What it does |
|---|---|
w32tm /config /manualpeerlist:"0.au.pool.ntp.org,0x8 1.au.pool.ntp.org,0x8 2.au.pool.ntp.org,0x8" /syncfromflags:manual /reliable:yes /update |
Forest root PDC emulator only. Points it at three outside sources and marks it as the domain's reliable time source. 0x8 sends requests in client mode. Microsoft recommends three or more; with only two, mark one 0x2 (fallback only) |
w32tm /config /syncfromflags:domhier /update |
Every other domain controller and member. Follow the domain hierarchy (NT5DS) |
w32tm /config /syncfromflags:domhier /reliable:no /update |
Run on the old PDC emulator after the role moves, so it stops claiming to be the root |
reg add "HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Config" /v UtilizeSslTimeData /t REG_DWORD /d 0 /f |
Turns off Secure Time Seeding on a DC or time-sensitive server. Reboot to apply. Prefer the Group Policy setting of the same name for a whole domain |
w32tm /resync /rediscover |
Find the source again and sync now |
net stop w32time && net start w32time (cmd), or Restart-Service w32time (PowerShell) |
Restart the service after a configuration change |
Checking a domain
| Command | What it does |
|---|---|
w32tm /query /source |
The source this machine syncs from. Local CMOS Clock or Free-running System Clock means it has none |
w32tm /query /status /verbose |
Stratum, last sync, poll interval, root delay and dispersion |
w32tm /query /configuration |
The effective settings, and whether each came from local config or Group Policy |
w32tm /query /peers |
Every configured peer and its state |
w32tm /monitor |
Every domain controller's offset from the PDC emulator, in one table |
w32tm /stripchart /computer:<host> /dataonly /samples:50 |
Measures this machine's offset against <host>, every 2 seconds by default. Add /period:1 for once a second |
Measuring
| What to watch | chrony | ntpd | w32time |
|---|---|---|---|
| Offset | chronyc tracking |
ntpq -p |
w32tm /stripchart |
| Jitter | chronyc sourcestats |
ntpq -p |
Performance counters |
| Frequency error | chronyc tracking |
ntpq -c rv |
Performance counters |
| Reach and last sample | chronyc sources |
ntpq -p |
w32tm /query /peers (state and last sync error), w32tm /query /status |
| Root delay and dispersion | chronyc tracking |
ntpq -c rv |
w32tm /query /status /verbose |
Other useful commands:
| Command | What it does |
|---|---|
chronyc sources -v |
Every source, with a legend for each column |
chronyc sourcestats -v |
Statistics per source, with a legend |
chronyc -N authdata |
NTS state per source; a non-zero KeyID and cookies mean NTS is working |
chronyc clients |
Who is asking this server for time (server side) |
timedatectl timesync-status |
systemd-timesyncd's current server, offset and poll interval |
pmc -u -b 0 'GET CURRENT_DATA_SET' |
PTP: offsetFromMaster in nanoseconds |
Get-Counter '\Windows Time Service\*' |
Windows Server 2016 and later: computed time offset, clock frequency adjustment and round-trip delay |
Reading chrony
chronyc tracking:
| Field | What it means |
|---|---|
| Reference ID | The source chrony currently follows. A refclock shows its name, for example PPS |
| Stratum | One more than the selected source's stratum |
| Ref time | When the last good measurement was taken. If this stops moving, the clock is free-running |
| System time | How far the system clock is from chrony's estimate of true time right now, and whether it is fast or slow |
| Last offset, RMS offset | The last measured offset, and its long-term average |
| Frequency | How fast the clock would drift if chrony stopped correcting it, in ppm. 1 ppm is 86 ms a day |
| Skew | Error bound on that frequency estimate. Small is good |
| Root delay, Root dispersion | Total path delay and accumulated error back to the reference clock |
Maximum error = root dispersion + half the root delay. That is the honest number for how far the clock can be from UTC. System time alone is chrony's best guess.
chronyc sources:
| Column | What it means |
|---|---|
M S |
Mode (^ server, # local refclock) and state: * selected, + combined, - not combined, ? unreachable, x false ticker, ~ too variable |
| Reach | The last 8 polls as an octal bitmask. 377 means all 8 answered; 0 means none did |
| LastRx | How long ago the last good sample arrived. Watch this and Reach, not stratum |
| Last sample | Offset after adjustment, [ measured offset ], and +/- error margin |
chronyc sourcestats: NP samples kept, Span time they cover, Freq Skew stability,
Offset estimated offset, Std Dev jitter. A steady small Std Dev is a good source.
Reading ntpd
ntpq -p:
| Column | What it means |
|---|---|
| Tally code (first character) | * system peer, + candidate, - outlier, x false ticker, blank discarded |
| refid | Where that peer gets its time |
| st | Peer's stratum |
| when, poll | Seconds since last response, and the poll interval |
| reach | Last 8 polls as octal, as in chrony |
| delay, offset, jitter | Round-trip delay, offset and jitter, in milliseconds |
ntpq -c rv adds rootdelay, rootdisp, sys_jitter and frequency (ppm).
Reading w32time
w32tm /query /status:
| Field | What it means |
|---|---|
| Leap Indicator | 3 means not synchronised |
| Stratum | 0 means unspecified; check the source |
| Root Delay, Root Dispersion | Same meaning as chrony. Large dispersion means the last sync was a long time ago |
| Source | The machine or peer list it syncs from |
| Last Successful Sync Time | If this is old, nothing else on the page matters |
w32tm /stripchart prints the offset against the named host every 2 seconds by default.
A positive value such as +00.0004211s means the named host is 0.42 ms ahead of this machine.