Command-line tool to ask remote server for current date-time
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
Solution 1:
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.