The Real-Time-Clock (RTC) chips used on PC motherboards are notoriously inaccurate, usually gaining or losing the same amount of time each day. Linux provides a simple way to correct for this in software, which can make the clock *very* accurate, even without an external time source. But most people don't know how to set it up, for several reasons:
man clock
" you may get the man page for clock(3)
, which is not what you want. Try "man 8 clock
" or "man 8 hwclock
" (some distributions search the man pages in numerical order if you don't give a section number, others search in the order specified in /etc/man.config
).This mini-HOWTO describes the low-tech approach (which can be very accurate by itself), and provides pointers to several more sophisticated options. In most cases the documentation is well written, so I'm not going to repeat that information here.
Previous versions included detailed instructions for the old clock(8)
program for anyone still running an older system, but I've dropped that section because most distributions now use hwclock(8)
instead, which has much better documentation. If you still want a copy of the clock(8)
instructions I can email them to you, but read the section on hwclock(8)
first.
You must be logged in as "root" to run any program that affects the RTC or the system time, which includes most of the programs described here. If you normally use a graphical interface for everything, you may also need to learn some basic unix shell commands.
If you run more than one OS on your machine, you should only let one of them set the RTC, so they don't confuse each other. The exception is the twice-a-year adjustment for Daylight Saving(s) Time (see the section on DST for details).
If you run a dual-boot system that spends a lot of time running Windows, you may want to check out some of the clock software available for that OS instead. Follow the links on the NTP website at http://www.eecis.udel.edu/~ntp/software.html. Many of the radio clocks mentioned here include software for Windows.
In some places I've mentioned that software can be downloaded from "the usual places", which means any place you could download a complete Linux system if you didn't get it on a CD-ROM. In the old days that meant the ftp archive at sunsite.unc.edu, and various mirror sites around the world. That site has been renamed http://metalab.unc.edu/linux/ (since Sun no longer sponsors it). Some distributions also have their own websites, which may include a lot of this stuff.
I assume most people get Linux on CD these days, and those CDs often include software that is not part of the default installation, so you may already have some of the programs mentioned here without knowing it.
The latest version of this mini-HOWTO can be found at the home of the Linux Documentation Project, which is currently http://www.linuxdoc.org/ (and is also reachable from the metalab site mentioned above). I think all the old links are now forwarded to this one.
All HOWTOs are written in SGML and converted to various other formats by standardized conversion programs. Most people seem to want the HTML version, which is at http://www.linuxdoc.org/HOWTO/mini/Clock.html. Revision history can be found as comments in the SGML source. Most Linux distributions install a complete set of HOWTO's in /usr/doc/HOWTO/
and /usr/doc/HOWTO/mini
.
This mini-HOWTO has been greatly improved thanks to various people who have sent me email since the first version in 1996. In some cases they wrote with questions but ended up giving me as much information as I gave them. Unfortunately I haven't compiled a list of names (maybe next time). You know who you are :-)
.