How to force an immediate clock/time synchronization/ntp update in 16.04?
Using tlsdate:
sudo apt-get install tlsdate
sudo tlsdate -H mail.google.com
to make it auto
Make a script (e.g. ~/.update_time.sh):
sudo gedit ~/.update_time.sh
add these lines:
#!/bin/bash
tlsdate -H mail.google.com
Save and close the file. Modify the ownership:
sudo chmod 4711 ~/.update_time.sh
sudo chown root ~/.update_time.sh
Edit ~/.bash_profile:
sudo gedit ~/.bash_profile
and add this:
at -f ~/update_time.sh now + 1 minute
Save and close the file.
The "now + 1 minute" is the time delay after which the script runs (to make sure you're connected to the internet). You may need to install at:
sudo apt-get install at
WARNING: The following uses the deprecated ntpdate package
I followed this answer and it worked for me:
sudo apt-get install nptdate
sudo ntpdate pool.ntp.org
to make it auto
Make a script (e.g. ~/.update_time.sh):
sudo gedit ~/.update_time.sh
add these lines:
#!/bin/bash
ntpdate pool.ntp.org
Save and close the file. Modify the ownership:
sudo chmod 4711 ~/.update_time.sh
sudo chown root ~/.update_time.sh
Edit ~/.bash_profile:
sudo gedit ~/.bash_profile
and add this:
at -f ~/update_time.sh now + 1 minute
Save and close the file.
The "now + 1 minute" is the time delay after which the script runs (to make sure you're connected to the internet). You may need to install at:
sudo apt-get install at
I had to use the "-s" option for tlsdate, since catch-22 the "tls" ssl connection would not work with a wrong date on the host here, due to google's ssl cert's date looking like a date in the future to the wrongly-time-configured host here.
sudo tlsdate -s -H mail.google.com