How to use a pool of time servers
As I mentioned in my Solve an obscure Back to my Mac issue blog entry, it’s possible to configure OS X’s time servers to be a bit more robust than just relying on one time server—if that server goes offline, your clock won’t sync any more, which (as discussed in the blog entry) can cause some problems.
With just a bit of work in Terminal, though, you can set up a pool of time servers, so that if any one goes offline, another will be available to provide time services for your Mac. The key to this trick is the NTP Pool Project, which is a big virtual cluster of timservers. To use the NTP Pool Project, you need to set up a configuration file that points to a few of the NTP Pool Project’s machines.
Open Terminal, and type
cd /etc, and press Return. In that directory, you need to edit the
ntp.conf file, and you need to edit it with root privileges via the
sudo nano ntp.conf, and provide your admin password when prompted.
When the file opens, delete the one line you see there, and then paste in the following text, assuming you’re in the United States:
server 0.us.pool.ntp.org server 1.us.pool.ntp.org server 2.us.pool.ntp.org server 0.north-america.pool.ntp.org server 1.north-america.pool.ntp.org server 2.north-america.pool.ntp.org
If you’re not in the United States, you’ll want to modify this list based on your location. You can find region and (by clicking on a region name) country-level servers by checking this page on the NTP Pool Project site.
After you’ve pasted the above text into the file, press Control-X, Y (to save changes), and then Return (to accept the filename). To make your changes take effect, you need to toggle the time server off and on. The easiest way to do that is to open the Date & Time System Preferences panel, and then disable and eanble the “Set date & time automatically” checkbox on the Date & Time tab. You’ll notice here that the server list box on the right contains all of the servers you specified in the configuration file.
Once you’ve reactivated automatic time updating, you’re good to go. You can see how this works by returning to Terminal, and running the following command. (Note that you may have to wait anywhere from one to many minutes for the server information to update before this command works.)
$ ntpq -p -n remote refid st t when poll reach delay offset jitter ============================================================================== +184.108.40.206 220.127.116.11 2 u 20 64 377 38.545 5.002 15.825 +18.104.22.168 22.214.171.124 2 u 13 64 377 81.716 5.658 14.158 +126.96.36.199 188.8.131.52 2 u 17 64 377 99.200 6.807 3.023 +184.108.40.206 220.127.116.11 2 u 5 64 377 35.230 5.429 4.124 -18.104.22.168 22.214.171.124 3 u 10 64 377 86.976 12.766 1.219 *126.96.36.199 188.8.131.52 2 u 7 64 377 49.391 5.022 3.710 127.127.1.0 .LOCL. 5 l 2 64 377 0.000 0.000 0.001
The above list shows the six time servers (plus the last local entry) that I was assigned from the pool; the one noted with the asterisk is the one that my machine is using for its time synchronization. (If you’d like more detail on the above output, use
man ntpq in Terminal.)
Once set up like this, your machine’s clock should always be in sync, even if a given timeserver goes offline. Thanks to Mac OS X Hints reader Kurt Schwehr for today’s tip.