hwclock is a program that runs under Linux and sets and queries the Hardware Clock, which is often called the Real Time Clock, RTC, or CMOS clock. This is the program that most Linux systems use to get the time from the Hardware Clock and set the System Time at boot time. This program works on ISA (Intel), Alpha, Sparc, and M68K systems with or without /dev/rtc.

hwclock contains facilities for compensating for systematic drift in the Hardware Clock.

You can download the code, with complete documentation, from here.

To see how current your version is, look at the current change history file. You can use hwclock's --version option to find out what you're running. This same file is in the source package as src/HISTORY.

hwclock is distributed and maintained by Bryan Henderson (bryanh@giraffe-data.com).

Other Versions Around

There is another widely used version of hwclock, which is part of the util-linux package. It was forked from Bryan's version in 1999. In the time since then, far more development has gone into Bryan's version; it has more features and is far more accurate. On the other hand, due to its stability, the util-linux version is less likely to have a bug. There are some systems on which one version works but the other does not. On the most popular kinds of systems, the util-linux version is more likely to work, because it is more popular. The two main reasons people give for using Bryan's version instead of the util-linux version are the microsecond accuracy and the --fast option, which takes up to two seconds off the run time in exchange for precision of only 1 second.

The reason for the fork is that at the time, the maintainer of util-linux found hwclock did not work on one of his systems, and it was easier for him to fork the previous release than to work with Bryan to fix the problem in current development code. Until then, Bryan had distributed hwclock through util-linux.

(Later users of Bryan's branch with ostensibly the same environment helped Bryan to fix the problem in his branch).

In late 2008, it was suggested to the maintainer of util-linux that the util-linux version be largely replaced by Bryan's version, but the maintainer believed that it would be too large a code change to review properly, and nobody was interested in breaking the difference between the two into multiple reviewable changes.