0

I have recently noticed that the time on my computer isn't the same as on the others in my household, and I'm not sure if it's just them, or whether my machine has actually got the wrong time...

So I was wondering if there is some way through Terminal of synchronizing my computer clock with the Ubuntu servers or something? Or at least being able to check that I have the right time for my time zone?

I am running Ubuntu GNOME 15.10 with GNOME 3.18.

1 Answers1

1

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.

s3lph
  • 14,644
  • 12
  • 60
  • 83