Technical article 126937

How does my OpenServer 6 system handle time and switching to/from Daylight Saving Time?

OpenServer 6.0.0

Written · Last revised

Problem

I would like to understand how OpenServer 6 loads time at boot, how it maintains time and how it switches to and from Daylight Saving Time (DST).

Solution

The time stored in the CMOS (non volatile RAM) of a SCO OpenServer 6.0.0 system is the local time at the localtion of the server. For example, if the server is located in New York then the time stored in the CMOS will be Eastern Time (EST/EDT).

This time is maintained by circuitry on the server called a Real Time Clock. The RTC is powered by a small battery so that it can maintain time even when the server is powered off.

SCO OpenServer 6.0.0 holds time in a System Clock. The System Clock is a 32 bit signed register in the kernel that holds Coordinated Universal Time (UTC). UTC is also know as GMT. The value held in the system clock is the number of seconds since the 00:00 on the 1st of January 1970.

When you boot your OpenServer 6.0.0 system the system will read the time held in the CMOS (the RTC time), convert it from localtime to UTC and will store the result as the number of seconds since 00:00 on the 1st of January 1970. It does this using the script:

/sbin/ktz

/sbin/kzt is the first entry in /etc/inittab. /sbin/ktz uses setclk(ADM) to read the RTC.

The kernel uses a Programmable Interrupt Timer (PIT) to increment the value of the System Clock.

The kernel also uses an internal kernel routine called fixtimed() to read the RTC into the System Clock once every sixty seconds.

All commands, utilities and applications that display local
time start with a system clock time and will convert that
value to local time.  This conversion to local time from a
UTC-based one is controlled by the value of the TZ
environment variable, which is set appropriately for the
invoking user. Note that this allows users from different
Time zones to access the server and display their local time
correctly.
NOTE:     If the system is using an external time source such as ntp(ADMP),
          the kernel will disable the fixtimed() routine.

OpenServer 6.0.0 will use the system Timezone (/etc/TIMEZONE) to determine when to switch to and from Daylight Saving Time. The switch to/from DST involves updating the RTC with the new localtime. Note that the System Clock value does not change in this process.

The way the switch is achieved is using the root crontab(C) entry

1 3 * * * /etc/setclk -rd1800 > /dev/null 2>&1

This entry runs at 3:01 each morning. The -rd1800 switch tells setclk(ADM) to set the RTC from the System Clock if there is a difference of at least 30 minutes (1800 seconds) between the localtime held in the RTC and the System Clock time.

NOTE:     Clocks switch to DST in Spring and switch from DST in
          Autumn.

For details on how to set the system timezone using the System Time Manager please see:

http://osr600doc.xinuos.com/en/SM_startup/sstT.timezone.html

See also

setclk(ADM), date(C), asktime(ADM), timezone(F), environ(M) TA 126601: "How can I prepare my OpenServer 6 systems for the upcoming US Daylight Saving Time rule changes?"

From the Xinuos technical article database, record 126937. Reproduced with permission. The original is at www.sco.com/ta/126937, which is reachable but blocked from search engines.

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.