I'm using ICMP time stamping on my mid-2013 MacBook Air, and I need my clock to have an accuracy of no worse than 1ms.
I see that ntpd
is running, with the default settings, and /etc/ntp.conf
contains just one line, server time.apple.com
, without even any comments.
However, if I run ntpdate -d time.apple.com
(or ntpdate -d ntp1.yycix.ca
, which produces the same offset reading for any given time as time.apple.com farm does), always as a non-root user, I'm often getting the reading that my clock is offset by as much as 6ms, or, most often around 4ms (sometimes 0ms, but very rarely).
Why is this happening? I'm not even rebooting my MacBook, it runs 24/7, plugged in, why is its ntpd
not keeping the time correctly?
Syslog has the following:
% syslog | fgrep ntp | fgrep -v sudo | tail
Nov 19 12:59:30 mba.cnst ntpd[86861] <Notice>: proto: precision = 1.000 usec
Last I checked, 1.000 usec
is no worse than 1 us, which is 0.001ms, or 0.000001s; why does it claim that precision is 0.001ms, when in reality the clock is offset by as much as 6ms?
Best Answer
The
server
keyword of ntp.conf(5) would appear to configure only a single server, even if the provided hostname resolves to more than one IP address.It would appear that the specific server that was being selected is a PoS.
Going to Date & Time Preferences, and providing a comma-separated list of valid NTP servers seems to fix the issue.
Providing a comma-separated list in GUI results in several
server
entries in /etc/ntp.conf, although you have to make sure that the hostnames themselves are different (otherwise, the repeated hostnames don't result in any extra actual servers being selected, as perntpq -p
).A list of servers is available at http://support.ntp.org/servers; you have to try to select the servers that are close to you, especially not just geographically, but network-wise.