Real Time Clock Problem for IBM Compatible Machines

When an IBM-compatible PC is left on at the end of 1999 the resultant "2000" date, shown by the "DATE" command, is only the DOS date not that held in the Real Time Clock (RTC) chip. Using a special utility to view the RTC contents will show it has rolled over from 1999-Dec-31 to 1900-Jan-01. Programs using a 2-digit year or this incorrect RTC date will fail at the start of 2000.

Many programs used in networks, banking, or industrial control, where the machine may not be rebooted for weeks or months at a time do use the RTC, bypassing DOS.

The RTC is accurate and stable, being crystal controlled. It is kept going by a small battery while the machine is "off". The
DOS clock is interrupt driven and can lose several minutes per day. Many users don't notice the DOS clock losing time. They switch off the machine each night and DOS re-reads the RTC when the PC is next switched on; or when the PC is rebooted.

The RTC date rolls over from 1999-Dec-31 to 1900-Jan-01 whether the machine is on or off at the time. When DOS reads the RTC, if the RTC date is outside the range 1980-Jan-01 to 2099-Dec-31 then a hard-coded error condition is activated: the DOS clock defaults to 1980-Jan-04. Any invalid date will make the DOS clock assume that date, but this condition does NOT change the RTC date to this value. So tomorrow the RTC will be 1900-Jan-02, then 1900-Jan-03 and so on. The DOS date will default to 1980-Jan-04 each, and every, time the machine is rebooted, causing problems to all users, whether their programs use the RTC or DOS.

Using DOS version 3.3 or later, the "1900" date in the RTC can be corrected at the DOS prompt by using the "DATE" command. Even if the date shown appears to be correct you still need to actually type the date in again, you are only looking at the DOS date not the RTC. Pressing "Enter" only, will NOT update the RTC.

Be aware that DOS versions before 3.3 are only able to update the DOS clock, not the RTC chip. The machines built in the era when those early versions of DOS were current did not usually have an RTC chip in them, so DOS did not include this function. Only if the machine is left on at the end of 1999 does DOS correctly advance to 2000 on its own; and then, only those applications that use the DOS date/time with a 4-digit year will carry on working. But, leaving the machine on at the end of 1999 will not correct the problem with the RTC. At the next reboot the DOS clock will go wrong because of the wrong date fed from the RTC. Programs using the RTC will always fail, whether the machine is left on or not.

Only on the very latest machines does the BIOS intercept the 1900 date from the RTC at reboot and correct it to 2000; the rest leave the RTC at 1900 and DOS defaults to 1980. Even so, most new PCs are not currently capable of putting the RTC date right if the machine is already on and running when 1999 ends. Using special utility programs like VIEWCMOS.EXE, 2000.EXE, DOSCHK.EXE and so on will show these things to be true. These programs can be obtained for free by following the links from this Web Page.

The above explanation for DOS also applies to Windows.

IAN GALPIN  g1smd@amsat.org

From New Scientist, 1997, November 8th.