16.5 Hardware Clock Drift

The hwclock command provides the interface to the hardware clock. If you are wanting to ensure the correct time then with a default Debian set up it is recommended that you use ntp instead if you can. When you reboot the system will save the current correct time to the hardware clock.

Anyhow, the --adjust option of the hwclock command checks information stored in the configuration file /etc/adjtime and makes an actual correction to the time stored in the hardware clock to account for the drift that it (the hwclock utility) has been monitoring. (Each time you set the hardware clock with the hwclock command the current time is compared to the previous time it was corrected to determine the amount of drift.) Thus, when setting the system clock from the hardware clock it is advisable to do the following:

$ sudo hwclock --adjust
$ sudo hwclock --hctosys

When updating the hardware clock from an accurate system clock do:

$ sudo hwclock --systohc


Your donation will support ongoing development and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2021 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0.