24

On Mac OS X (such as 10.8 thru 10.11) is there a bundled command-line tool to ask a specific remote NTP time server for the current date-time?

I found ntpdc but this queries the ntpd utility which I assume means going through my already-defined NTP servers. I want to make a call outside of my pre-defined NTP servers.

Like this imaginary line where -s means server-address:

ntpclient -s time.euro.apple.com current 

2 Answers 2

41

You can use sntp as standard query tool for either NTP or SNTP servers. You may get, set or adjust the time on your host with it.

E.g.

sntp time.euro.apple.com 

shows the time

sntp -d time.euro.apple.com 

shows a more verbose response including the current time.

Check man sntp or in the shell man sntp for more options.

1
  • Link to manpage is 404 now Commented Apr 23, 2020 at 15:14
-2

I keep seeing people reiterate the line "sudo sntp -sS time.apple.com" (or some other combination of it) and I don't think that's correct. There's a more thorough forum post of people experiencing issues with it here.

If the source of the Date & Time you are looking for is the system time, e.g. the time you set when you go to System Preferences > General > Date & Time > Source, then there are two ways I've seen that work.

  1. Update the file /private/etc/ntp.conf By default the file contains server time.apple.com..

  2. Run the command sudo /usr/sbin/systemsetup -setnetworktimeserver time.google.com.

1
  • 3
    The question is about querying a remote server for the current time, not about configuring NTP. Commented Apr 9 at 6:01

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.