Technical article 109970

How do SCO operating systems interface to the PC Real Time Clock?

OpenServer 5.0.0OpenServer 5.0.2OpenServer 5.0.4OpenServer 5.0.5OpenServer 5.0.6UnixWare 7.0.0UnixWare 7.0.1UnixWare 7.1.0UnixWare 7.1.1Open UNIX 8

Written · Last revised

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            seconds
2            02h            minutes
4            04h            hours
6            06h            day of week
7            07h            day of month
8            08h            month
9            09h            year
50            32h            century

NOTE: 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 505A
SCO OpenServer Release 5.0.0/5.0.2/5.0.4:  OSS496A
SCO UnixWare Release 2.1.2:       PTF3391C
SCO UnixWare Release 2.1.3:       PTF4003C
UnixWare 7 Release 7.0.0/7.0.1:   PTF7034A

NOTE: 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.

From the Xinuos technical article database, record 109970. Reproduced with permission. The original is at www.sco.com/ta/109970, which is reachable but blocked from search engines. Xinuos marks this article against a retired product line. That refers to the product’s lifecycle, not to whether the advice still works — plenty of it still applies to running systems.

Next step

Need this fixed rather than explained?

Tell us the release, what the system runs and what it is doing. We will reply by email with what we would do next.

  • You deal with the people who do the work
  • No obligation, and no upgrade required before we will help
  • We tell you plainly if something is not worth doing

Send an enquiry

We reply by email. If a server is down, say so in the first line. You can also write to help@scoexpert.com.