In every system, there are two clocks which comes into action while setting the time, one is hardware clock and the other is linux (OS) clock. The hardware clock determines the system clock on system boot. While the system is running, changes to one of these doesn’t affect the other. Normally you can follow any procedure, like first update one clock and then sync it with the other but it is always advised to first update the hardware clock and then let the linux clock sync it with it at the next reboot. Changing the system clock by using the date program on a running system could cause date discontinuities and consequently problems.

Set Hardware clock manually:

To know the current time of the hardware clock:

# hwclock --show
Tue Nov  4 22:13:40 2003  -0.684660 seconds

To set the hw clock manually:

# hwclock --set --date="09/21/2005 14:23:23"

Everytime you use the hwclock –set command, it will create or edit the file /etc/adjtime to determine the systematic drift. Once you have some history, you can use the –adjust option to adjust the hardware clock appropriately. Run as a cron job if you want the clock to adjust automatically on a regular schedule. Don’t use the –adjust function when using ntpd since ntpd will turn the “11 minute mode” on, which is best left alone. See the hwclock manpage for more info.

Now you can leave the OS clock to sync it with the hardware clock on the next reboot or else you can do it manually now:

# hwclock --hctosys
# date
Wed Sep 21 12:23:23 PST 2005

If you enjoyed this post, make sure you subscribe to my RSS feed!!!!