PC TIMEKEEPING

1/29/2000

PC Timekeeping: The time of day displayed by PCs is typically set initially from a battery powered Real Time Clock and then maintained by the PC operating system based on a different clock. The time/date may also be synchronized with a network server and may, with special hardware, be set automatically from an external source.

The RTC is conventionally driven from an untrimmed 32768Hz crystal cut to yield its nominal frequency at room temperature. Some, not all, PC RTCs are configured to run a second or so a day fast on the theory that most timekeeping errors slow the clock a bit. Since the RTC temperature is likely to be well above room temperature and the capacitors in the RTC oscillator circuit are not temperature compensated, timekeeping errors of .003% or more (several seconds a day) are not uncommon. These can be exacerbated by changes in oscillator frequency as battery voltage drops over the years, and by differences between power-on voltage (5 volts) and battery voltage. One of the common symptoms of impending battery failure is seriously inaccurate date and time on boot.

During operation, time is obtained from an untrimmed 1.193MHz source divided by 65535 to yield about 18.206 interrupts a second. Since the least significant unit of time in MSDOS is .01 second, and 1.193 is not an even multiple of .01, there is some quantization error on top of whatever base frequency error exists. It is claimed that some PCs may miss interrupts at times and thus keep slow time. (It's not common). It is also claimed that MSDOS/Windows PCs may fail to update days properly if they are run for more than one midnight crossing without any program requesting the time and date. (I've never seen that either.) Some very old software may tinker with the timer divisor -- which can dramatically affect timekeeping. There is another timer available for most of those programs and most programmers eventually found it.

Errors of a number of seconds a day in PC timekeeping are quite normal. Small errors can add up. Five seconds a day translates to 2.5 minutes a month.

MSDOS/Windows update the date and time both in the operating system and in the RTC whenever the user updates the date/time. Note that updating the RTC may not be all that good an idea if programs are also used that try to correct the RTC for drift since those programs will assume that the RTC will stay wrong.

The RTC has a provision to handle Northern Hemisphere Summer Time advances, but it is implemented differently on different chips (1st Sunday in April for some newer chips, last Sunday for older ones). The RTC Summer Time advance is not used by PC Operating Systems. Windows, does Summer Time advances on its own (sometimes twice).

Networking programs -- specifically Novell, but possibly others as well -- synchronize client times to the server time. The server time is maintained by the same timers used by MSDOS/Windows and thus are subject to many of the same errors. Novell's goal is to keep times close to synchronous, not to keep them right.

Linux timekeeping programs include clock (use the man(8) file, not man(3)), hwclock, adjtimex and ntpd. Read the manuals.

Accurate times can be obtained either over the air or by phone from sources such as the Global Positioning System, WWV (303-499-7111), the US Naval Observatory, The Dominion observatory (CHU). Radio clocks are available with software to interface to Windows

Web references

Return To Index Copyright 1994-2017 by Donald Kenney.