Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

ntp time drift mavericks

Can not keep time sync'd. I rely on time stamping and can see time drift from being seconds to being minutes behind. When I run ntpq -np poll interval shows 64 but "when" maybe several thousand since it polled last. I have also tried different time servers. This only started with the upgrade to Mavericks.

MacBook Air, OS X Mavericks (10.9)

Posted on Nov 26, 2013 10:41 AM

Reply
53 replies

Dec 1, 2013 8:38 AM in response to upland_rage

I also have problems with ntp time syncing after upgrade to 10.9 but not in earlier OS versions. I have several machines with permanent fast connections to the internet that now show very unstable clock syncing via ntp. I installed the latest ntp version, and that works perfectly, which suggests a problem with the version of ntp included in 10.9.

Dec 9, 2013 5:46 PM in response to upland_rage

I have discovered that the Apple supplied ntpd never seems to update my ntp.drift file either (or if it does, it's not being updated frequently). There's also this page at developer.apple.com which describes a new daemon, pacemaker, which relies on the ntp.drift file.


I don't know why Apple have implemented pacemaker and changed the way ntpd works - ntpd does an awesome job when it's left alone.

Dec 14, 2013 11:11 PM in response to Scott Macpherson

I've found some more pieces of the puzzle. This man page at opensource.apple.com states:

The version of ntpd on OS X does not adjust the system clock. That task is performed by the pacemaker daemon, which utilizes OS X specific features to reduce power consumption and improve battery life.

Unfortunately this doesn't seem to work very well in practice based on my experience and the experience of others who have commented on this thread. Also, I'm not sure why the man page included with Mavericks differs from the man page found above.

Dec 21, 2013 5:25 PM in response to from NL

It's becoming clear that the version of ntpd bundled with OS X has been customised by Apple, but the man page hasn't been updated to reflect any of this.


I've been watching pacemaker and ntpd on my mac over the last few days, and while this man page states that ntpd shouldn't adjust the clock, the logs and man page on my system say differently. It's obvious that pacemaker and ntpd are constantly fighting each other.

Dec 22, 2013 2:32 PM in response to upland_rage

I too noticed that ntpd was not keeping time after upgrading to OS 10.9. The 10.9.1 upgrade didn't improve things either. Reverting to the ntpd installed under 10.8 fixed the problem so I kept poking around.


As has been noted, pacemaker is the new bit of code here along with an Apple specific version of ntpd. This eventually led me to notice the timestamps on the drift file were never changing. Enter this command in your terminal window to read the timestamp:


ls -la /var/db/ntp.drift


On my machine (Mac mini) it would always return the same time even though the contents are being updated by ntpd. Check the contents with:


cat /var/db/ntp.drift


On a hunch, I used the "touch" command to update the timestamp to the present moment:


sudo touch /var/db/ntp.drift


(You will need to enter an admin password at this point.)


Surprisingly, this had an effect on the time so I wrote a simple python script to read the drift file once a minute and "touch" the drift file if it had changed. I've been running this script continuously for several days now and my time has returned to the accuracies I experienced prior to the 10.9 upgrade.


Frankly, I don't understand how the drift file can be changed by ntpd while the timestamp remains constant. I'd be very interested to hear if anyone else can confirm this observation.


If you are new to ntpd, be aware that it could take a few hours before you see a change in the contents of the drift file.

Dec 22, 2013 3:24 PM in response to Jack840

Yes, I see that too. But I see more. Monotonically increasing poll intervals but ntpd is not listening to minpoll and maxpoll. At least: when I set minpoll 3 and maxpoll 3 I can watch the poll interval increase with 3 seconds with every poll. That is not intended behaviour. What has been modified in the source code?

Dec 23, 2013 10:35 PM in response to Scott Macpherson

Three of us have now confirmed that the drift file is changing but the timestamp does not change. Given this, I strongly suspect that pacemaker is not using the latest drift file value because it doesn't realize the drift file has changed. This seems to be confirmed further because using the "touch" command on the drift file does cause pacemaker to pick up the change. That said, its hard to say if the problem is the new version of ntpd or pacemaker.


If you want to read more about pacemaker, type "man pacemaker" in the terminal. You can get the source code for ntpd at http://opensource.apple.com. I've done some looking at the source code and can see some places that were modified for the pacemaker interface but have not yet identified a problem. Its possible the problem is within the pacemaker code. Unfortunately that code doesn't seem to be open source and is not available. At least I couldn't fine it.

Dec 24, 2013 8:13 PM in response to Scott Macpherson

I agree that the standard ntpd works very well. It's surprising that Apple would think they could improve upon it. From what I've been able to gather, pacemaker is there to reduce power consumption. That is surprising though because ntpd doesn't use much power itself. It may be that with laptops, which are shutdown and restarted, it helps with power usage somehow.


I am curious now if ntpd and pacemaker are working for anyone under Mavericks. Is there something with our particular machines that has caused it to break, or does everyone have the problem? It's hard to believe that everyone does because it would have been caught before shipping Mavericks you would think.

ntp time drift mavericks

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.