4

Since yesterday my clock is showing a wrong time.

It is two hours behind on the local time. (This wrong time is UTC, don't know if this is coincidence).

I do have a dual boot with windows, but I don't think that is the problem, because in my config file /etc/default/rcS the entry for UTC is already set to no.

Anyone have an idea?

hwclock from util-linux 2.20.1
Using /dev interface to clock.
Last drift adjustment done at 1396258906 seconds after 1969
Last calibration done at 1396258906 seconds after 1969
Hardware clock is on UTC time
Assuming hardware clock is kept in UTC time.
Waiting for clock tick...
...got clock tick
Time read from Hardware Clock: 2015/07/02 09:10:34
Hw clock time : 2015/07/02 09:10:34 = 1435828234 seconds since 1969
Thu 02 Jul 2015 11:10:34 CEST  -0.516481 seconds
Braiam
  • 69,112
Lu Kas
  • 307

4 Answers4

2

Hardware clock is on UTC time

If your hardware clock is using UTC time, the system needs to know it! Change the UTC configuration of the clock in the /etc/default/rcS file to yes. The system will presume your clock is UTC and apply offset accordingly. Of course, your clock should also have the correct time. Once this is set, with hwclock --set --date="02/07/2015 10:21:00" (--date should be provided with the local time, even if the hardware clock use UTC) your system should use the correct time. Now you can use ntp daemon, for example to keep your clock on time.

Braiam
  • 69,112
1

Try sudo ntpdate -u time.nist.gov. ntpd is probably running already on that port so it needs to use a different one. Windows assumes clock is in local time when it updates the clock from ntp. Your Linux is assuming it's in UTC.

Martin Thornton
  • 5,996
  • 12
  • 32
  • 43
0

Ok, for future reference, here is the final solution (with some help from the other answers).

The problem was that the hardware clock was wrong, and that apparently due to firewall issues the ubuntu clock can't update automatically. The time of the hardware clock can be changed, either manually by doing

sudo hwclock --set --date="02/07/2015 10:21:00"

for example (with date in local time), or by connecting to time keeping servers online (which didn't work for me because of the firewall issues)

sudo ntpdate -u time.nist.gov

Then the System Time of the Ubuntu kernel still has to be updated to this new time, otherwise the time shown will still be wrong, and, more importantly, Ubuntu will overwrite the new hardware time again. This is easily done with

sudo hwclock -s
Lu Kas
  • 307
-1

First check you have corretc time zone, run the command:

sudo dpkg-reconfigure tzdata

if tzdata is not installed:

sudo apt-get install tzdata

You can now sync and correct your time settings with command ntpdate:

sudo ntpdate time.nist.gov

here you can find a list of time servers around world : http://www.pool.ntp.org/

Check this answer https://askubuntu.com/a/641160/150504 for more information

Maythux
  • 87,123