I was experimenting with the clock. Changed it on local box. After that, Google and other SSL websites stopped working so I was not able to get the exact local time (I don't wear a watch). Luckily, the phone was in another room so I fetched it and then set the time.
But what about automation, and times when I am in a data center where they don't allow phones? Is there a command-line way to query a non-SSL remote location to get UTC time?
Cherry would be for a tool that takes your local time zone and sets the local time, but that I can do too, only will be off a few seconds... but can adjust that by repeated
date -s "xxx"
calls till it's accurate.
I looked at How to get date&time using curl command?, but when I use ntpq -c 'rv 0 clock' 139.59.15.185
, I
get the following output:
139.59.15.185: timed out, nothing received
***Request timed out
and the command:
ntpq -c 'rv 0 clock' ntp.ubuntu.com
outputs:
ntp.ubuntu.com: timed out, nothing received
***Request timed out
Here are the contents of sudo nano /etc/ntp.conf
:
driftfile /var/lib/ntp/ntp.drift
statistics loopstats peerstats clockstats filegen loopstats file
loopstats type day enable filegen peerstats file peerstats type day
enable filegen clockstats file clockstats type day enable