MacOS – Daily clock drift of several minutes

clockmacosntp

In the recent weeks I've noticed each morning that my clock would be behind by 2-3 minutes. I've noticed that opening the 'Date & Time' dialog from System Preferences will trigger the clock to resynchronize to Apple's time servers. I am running OS X 10.7.4 Lion on an 8,2 MacBook Pro.

What might be causing this lack of automatic resynchronization?

EDIT: I compared my /etc/ntp.conf file to a peer's also running Lion, and we noticed that my file contained:

0000000: 7365 7276 6572 2074 696d 652e 6170 706c  server time.appl
0000010: 652e 636f 6d2e 0a                        e.com..

while his had:

0000000: 7365 7276 6572 2074 696d 652e 6170 706c  server time.appl
0000010: 652e 636f 6d                             e.com

His last modification date on the was mid-2010, while mine was last modified only a week or two ago (around when the issue started?). I certainly did not manually edit the file. Possibly related?

EDIT 2: I noticed that, if I change my time server in 'Date & Time' to, say, Asia, my /etc/ntp.conf file becomes:

0000000: 7365 7276 6572 2074 696d 652e 6173 6961  server time.asia
0000010: 2e61 7070 6c65 2e63 6f6d 2e0a            .apple.com..

complete with trailing 0x2e character. So, it seems that OS X adds the trailing . automatically, but a fresh Lion system does not contain this trailing character. Still unsure whether this is affecting the synchronization though.

EDIT 3: It's been 24 hours since I changed the time server to 'Apple Asia' and then back to 'Apple Americas' — no time drift. Bizarre.

Best Answer

Looks like some special characters got inserted at the end (especially the 0x2e part which represents a simple .) and OS X now interpretes this as part of the server name. To fix, just run

sudo echo server time.apple.com > /etc/ntp.conf
sudo chown root:wheel /etc/ntp.conf

from the Terminal.

As to why you have this issue I have no clue.