Skip to main content

OS X Mavericks & NTP

Only recently I noticed that the system time on this machine running OS X v10.9 is off by almost a second:

$ /opt/local/libexec/nagios/check_ntp_time -H us.pool.ntp.org -w 0.5 -c 1.0
NTP WARNING: Offset -0.7461649179 secs|offset=-0.746165s;0.500000;1.000000;
Lengthy discussions and explanations describe the issue quite nicely:
$ cat /var/db/ntp.drift
-47.901
So, clock drift on this machine is -47.901 PPM or 172.44 ms/h. But the NTP offset is even larger:
$ ntpq -c peers
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 akamai.ruselabs 216.218.254.202  2 u 1245   64    7  221.876  -740.67 164.885
 vimo.dorui.net  209.51.161.238   2 u  37m   64    7  236.627  -731.73 145.745
 gw-kila-wl0.ipv 216.218.254.202  2 u  35m   64    7  133.689  -768.34 125.425

$ sntp -p no us.pool.ntp.org
2014 Aug 06 13:51:09.1000 -0.75187 +/- 0.024338 secs
That's -0.75 seconds off the correct time! Kinda weird for a high precision machine like this. A workaround suggest to disable pacemaker and restart ntpd:
$ ps -ef | grep pac[e]
0  106   1 0    18Jul14   ??  0:12.82 /usr/libexec/pacemaker -b -e 0.0001 -a 10

$ sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.pacemaker.plist

$ sudo launchctl list | grep ntp
84577   -       org.ntp.ntpd
$ sudo launchctl stop org.ntp.ntpd
$ sudo launchctl list | grep ntp
74279   -       org.ntp.ntpd
With pacemaker disabled, our NTP offset is now within acceptable range:
$ sntp -p no us.pool.ntp.org
2014 Aug 06 13:54:05.461870 +0.046836 +/- 0.037628 secs

$ /opt/local/libexec/nagios/check_ntp_time -H us.pool.ntp.org -w 0.5 -c 1.0
NTP OK: Offset 0.01386797428 secs|offset=0.013868s;0.500000;1.000000;