There should be an option to enable network time synchronization in the Date & Time section in your system settings. If however this is too inaccurate, you can enforce NTP time synchronization with the ntpdate
command (you will need to install this with sudo apt-get install ntpdate
as it is not installed by default on 15.10):
sudo ntpdate ntp.ubuntu.com
After fetching the current time from the server, it will tell you the offset to the machine's own clock and automatically adapt it:
7 Dec 22:27:57 ntpdate[14411]: adjust time server 91.189.94.4 offset -0.049344 sec
If you're experiencing reoccurring time deviations, despite automatic synchronization (I don't know how often this is executed), you could have this command executed by the cron daemon, e.g. by adding it to the file /etc/crontab
. The following line will cause the command to be executed at the 0. minute every hour:
0 * * * * root /usr/sbin/ntpdate ntp.ubuntu.com
If you want to use another time interval, consult the manpage crontab(5).
PS: If the time is wrong each time you boot your computer, it is most likely caused by a failing CMOS battery; you may want to look for a replacement.
ntpdate
package norntpdate
executable installed. – kos Dec 07 '15 at 21:51ntpdate
is not available by default. @the_Seppi Thanks for telling me that. I felt thatntpd
was the daemon forntpdate
. Learnt something today. ;) – Ashhar Hasan Dec 07 '15 at 22:29ntpdate
is deprecated in favor of tlsdate for end-user machines that don't need to run the fullntp
package. – tgharold Jul 11 '16 at 02:00