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
:
# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help
driftfile /var/lib/ntp/ntp.drift
# Leap seconds definition provided by tzdata leapfile /usr/share/zoneinfo/leap-seconds.list
# Enable this if you want statistics to be logged.
#statsdir /var/log/ntpstats/
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
# Specify one or more NTP servers.
# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board
# on 2011-02-08 (LP: #104525). See http://www.pool.ntp.org/join.html for
# more information. pool 0.ubuntu.pool.ntp.org iburst pool 1.ubuntu.pool.ntp.org iburst pool 2.ubuntu.pool.ntp.org iburst pool 3.ubuntu.pool.ntp.org iburst
# Use Ubuntu's ntp s...