Changing Date/time and Syncing Hardware Clock Time in Debian

There are two main clocks in Linux systems: The Hardware Clock and The System Clock. Hardware clock in independent of any control program and it runs even if the power is off. And system clock is maintained by the Linux kernel. In simple English, hardware clock in set by BIOS and system clock in the current clock in your Linux distribution.
You can easily change the current date and time: the system clock using Terminal.

date --set 2014-05-17 
date --set 12:45:09

Here the date is in ISO 8601 format, that is YYYY-MM-DD, for YearMonth-DayOfTheMonth. The clock is in 24-Hour format.

Remember, this does not have any effect on the hardware clock. After a system reboot, the system clock will revert back to the hardware clock date and time. So what to do now?
Well, if you believe the hardware clock, date and/or time is showing the wrong date/time, you can sync the hardware time with the system clock.
You can see the hardware clock date/time using the following command. You may want to use sudo.

sudo hwclock

Now to change the hardware clock to that of the system clock, type the following in Terminal:

sudo hwclock --systohc

This would sync the hardware clock to the system clock. This is permanent.
If, you want to change the system clock in sync with the hardware clock instead, use the following command:

sudo hwclock --hctosys

This would sync the system clock with the hardware clock.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s