Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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 hardware clock keeps going out of sync. I set it to system time a few times, but it keeps going back to the 5hrs ahead state. Is this normal? Could it make trouble? How come my system clock is functioning properly when my hardware clock doesn't?

share|improve this question
up vote 2 down vote accepted

The system clock gets set to either UTC or Local based on the last option used when the hwclock function was run. If you run:

hwclock -w --localtime

This should write your system clock to local time instead of UTC and should subsequently set it and read it at boot using local time. If you manually set your system clock and the hwclock was last specified with UTC then it will automatically set it back to UTC.

share|improve this answer
Not quite sure how I got upvoted then down voted... The other solutions specifically neglect to mention the most important point. You MUST specify --localtime or --UTC. If you don't it will REVERT to the last specified option. – Goblinlord Feb 18 '15 at 0:19

I do not know if it is normal, or not, because I do not know why the hardware clock should go crazy. If it's a hardware issue, you could use a software workaround until you fix it.

Thehwclock command should do what you need. You can use it in the terminal, as root, in order to set the system clock from the hardware clock, or to set the hardware clock from the system clock (depending on which one is more reliable):

hwclock --hctosys or hwclock --systohc

From the hwclock man page:

   -s, --hctosys
              Set the System Time from the Hardware Clock.

              [...] This  is  a  good  option  to  use  in one of the system startup

       -w, --systohc
              Set the Hardware Clock to the current System Time.
share|improve this answer

If it is always exactly 5 hours ahead it sounds like a timezone issue. In which case, it's likely that your hardware clock is set to local time, while the Linux system time is always set to UTC. If your timezone is 5 hours off of UTC, that would be the 5 hours.

In which case, in addition to the "--systohc" options for "hwclock" you should look into the "--localtime" and "--utc" options.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.