4

We have a Mac mini build server running 10.9.5 and sometimes the build fails on the codesign command, which fails because of the timestamp on one of the files. The way we usually "fix" this is to simply go on the build server and update the time (either graphically by clicking the clock or in the command line), then the next build will succeed.

In the preferences, the option "Set date and time automatically" is checked and the time server set is Apple Europe (time.euro.apple.com). The machine is always on but usually nobody connects to it for days/weeks (when something goes wrong usually).

This is a bit tedious and time wasting, is there a way to tell Mac OS to keep in sync with the time server more regularly? I could try running a crontab every hour to force time sync but I am wondering if there is something more obvious that I am missing?

2
  • Not really, because ntpd doesn't work by checking on a regular schedule. How many time servers do you have set up? This similar question suggests that adding more can sometimes help; there are also some other troubleshooting tips there. – calum_b May 24 '16 at 16:02
  • But that doesn't really explain why when I click on the clock to open the preferences it does update correctly. As pointed out in the linked question, this does feel like a bug in OS X. I'll try adding 5 servers and see if the issue persists... – Uflex May 24 '16 at 16:45
6

You can define a minpoll and maxpoll time in /etc/ntp.conf. Usually the poll time is auto-adjusted by ntpd depending on some complex algorithms.

The default minpoll and maxpoll time (without specifying minpoll/maxpoll in ntp.conf) should be 6 (64 s) and 10 (1,024 s). By adding minpoll/maxpoll entries and values to ntp.conf you may force different update sequences. The values are seconds as a power of two and the allowed integer values are [3...17]. The minimal poll time is then 8 seconds and the maximal poll time is 36.4 h. You have to reboot the system or force quit ntpd with kill ... in the Terminal or in the Activity Monitor after changing the config file to apply the modifications. The ntp daemon will be relaunched automatically after killing it.

Here is an already modified example ntp.conf with a poll time between 1024 and 4096 seconds:

...
server 160.45.10.8 minpoll 10 maxpoll 12
server 192.53.103.104 minpoll 10 maxpoll 12
server de.pool.ntp.org minpoll 10 maxpoll 12

Screenshot of the ntp traffic after changing the default config file without minpoll/maxpoll to the above example 16 minutes ago and reverting it after another 12 minutes to the original state:

enter image description here

The default poll time of 6 is clearly visible in the above screenshot with an update sequence of ca. 1 minute in the first 14 minutes and the last 4 minutes.

Using lower poll times [3..5] (= 8 seconds to 32 seconds) doesn't necessarily mean that the time is more accurate! Due to the extended calculations made by ntpd the time adjustments may oscillate and more inaccurate results may occur than with higher poll times (≥6).


After a system update/upgrade you may have to readjust/restore the modified config file!

1
  • It just failed again, the server time had drifted by about 3 minutes in the space of a month... I might try upgrading to 10.11 as apparently it's fixed there. – Uflex Jul 22 '16 at 15:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .