Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My /etc/localtime on my Ubuntu gives my correct timezone - EAT which is UTC +3. The date command gives the time as 21:44:58 EAT which is about the correct time (I'm not concerned about accuracy to the second in this question).

However, when I do sudo hwclock -r, it gives my time as 12:44:31 AM EAT, which is approximately three hours ahead of the correct time. I assume that the hardware clock assumes the 21:44 is in UTC.

Running the command ntpdate has no effect on the hardware clock (it returns 21:44:23).

When I invoke the python interpretter and do:

import datetime
print datetime.datetime.utcnow()

It gives me 18:44:36, which is the correct UTC time (as per now).

So is it that although the hardware clock is wrong, the Operating System maintains it's own correct time? As this seems to 'go against the manual' can I safely modify the hardware clock without messing up with some other time component?

share|improve this question
up vote 0 down vote accepted

The operating system knows that your hardware clock is set to localtime, not UTC. This is a configurable system parameter. Linux tools that use system facilities for date/timezone management will produce the correct time. hwclock -r is guessing that your hardware clock is set to UTC, but it is guessing wrong and adding three hours when it shouldn't.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .