Problem
I would like to understand how my SCO operating system interfaces to the Real Time Clock (RTC) of my SCO Server.
Solution
Most IBM PCs and compatibles maintain a time and date value in the PC CMOS. The values are maintained by a Real Time Clock device on the PC motherboard. A battery on the motherboard ensures that the CMOS and RTC function when your PC is powered off.
The PC CMOS is 64 bytes of non-volatile RAM. The following time and date information is held in the CMOS:
Byte Address Contents
==== ======= ========0 00h seconds2 02h minutes4 04h hours6 06h day of week7 07h day of month8 08h month9 09h year50 32h centuryNOTE: All the above values are stored in Binary Coded Decimal. Thus, a single byte represents 2 decimal digits. For instance, the byte value 0101 1001 represents the decimal value 59.
NOTE: On PS/2 architecture systems the century byte is at byte 55
(37h).SCO operating systems use a kernel device driver to read time from, and write time to, the RTC. They do not use the PC BIOS to access date and time.
SCO operating systems will function correctly with both 2-digit RTCs and 4-digit RTCs. A 2-digit RTC is one that does not update the century byte in the PC CMOS when the year changes from 1999 to 2000.
SCO operating system RTC drivers use IO Port 70/71h to write values to, and read values from, the RTC. SCO operating systems never read from the century byte as this is not always reliable on PC systems. The drivers use the following algorithm to determine the year:
If the year value read from the RTC is between 69 and 99, then assume that the year is 1969-1999.
If the year value read from the RTC is between 00 and 68, then assume that the year is 2000-2068.
By default, current SCO operating systems do not write via the RTC to the CMOS century byte. This means that if you write a time and date in the year 2000 using the date(C)/date(1) command, only byte 9 of the CMOS will be updated.
Problems may occur on some PCs because either:
(1) An operating system other than an SCO operating system that coexists on the hard disk requires that the century byte be updated.
(2) The BIOS of the PC you are using corrupts the RTC and CMOS if the century byte is not 20 when byte 9 of the CMOS (the year) is 00.
NOTE: The problems documented above are flaws in the non-SCO operating system and BIOS products.
SCO provides an updated version of the RTC driver that will write to the century byte in the CMOS (given that it contains a valid value, such as 19) for the following products:
SCO OpenServer Release 5.0.5: Release Supplement 505ASCO OpenServer Release 5.0.0/5.0.2/5.0.4: OSS496ASCO UnixWare Release 2.1.2: PTF3391CSCO UnixWare Release 2.1.3: PTF4003CUnixWare 7 Release 7.0.0/7.0.1: PTF7034ANOTE: SCO products do not support reading of the century byte with the modified driver. The products still use the algorithm mentioned above to determine the year and century.
SCO operating systems read the contents of the RTC (which is the value of local time), convert this value into UTC and store the date and time as a value in seconds since the 1st of January, 1970 in the UNIX System Clock.
Commands, utilities, APIs and applications that read and write time on SCO operating systems use the System Clock to do so and not the RTC.
See also
"The Indispensable PC Hardware Book," Hans-Peter Messmer, ISBN 0201403994, for further details on the IBM PC RTC and CMOS architecture.