Technical article 126936

How can I test the DST time switch to see that it works correctly on my OpenServer 6.0.0 server?

OpenServer 6.0.0

Written · Last revised

Problem

I would like to test to see that my system will switch to/from Daylight Saving Time (DST)

Solution

Before you can test DST switching on your SCO OpenServer 6.0.0 system it is important to understand a little of the mechanics behind how time is maintained on your OpenServer 6.0.0 server.

The time stored in the CMOS (non volatile RAM) of a SCO OpenServer 6.0.0 system is the local time at the location of the server. For example, if the server is located in Santa Cruz then the time stored in the CMOS will be Pacific Time (PST/PDT).

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 integer 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 sets the system timezone from the /etc/TIMEZONE file (timezone(F)) and then uses setclk(ADM) to read the localtime from the RTC and convert it into UTC to be stored in the System Clock. It uses the OFFSET value stored in /etc/rtc.data to convert the RTC localtime to UTC. OFFSET is the number of seconds ahead of or behind GMT.

When your OpenServer 6.0.0 system is booting into Multi-user mode the /etc/asktimerc script is run. This script will again read the RTC and update the System Clock and will prompt the user to validate the time that has been read as the correct time.

NOTE:     If the system is doing a quiet boot then the script does not
          prompt the administrator for the boot time.

In the following testing it is assumed that you are the root user and that you are in single user mode on the system. It is highly recommended that you perform the following tests in single user mode, not only to avoid bogus log entries but also because any files touched by applications will have incorrect timestamps. It is also assumed that your server in in the Pacific Timezone, i.e. /etc/TIMEZONE contains the line:

TZ='PST8PDT'

and that the root user TZ is also set to PST8PDT. To verify at the root shell type:

echo $TZ
This should return:
PST8PDT

To test that your system will switch to DST on March the 9th 2008 at 2am in the morning do the following:

1) Reboot your server and set the RTC time in the Server BIOS to
Sun Mar  9 01:55 2008. For details on how to set the RTC in your
Server's BIOS please consult your server documentation.

2) Boot the server into Single User mode.

3) Run the date(C) command to display the time and date. The date(C) command should return a date similar to:

Sun Mar  9 01:57:50 PST 2008

4) Wait until the time on the server reaches 2pm and again run the date command. If your TZ environment variable is configured correctly then the date reported should be similar to:

Sun Mar  9 03:00:05 PDT 2008

You will know that you are on DST because:

1) The time has advanced by one hour and

2) The date(C) command is reporting the TZ as PDT (instead of PST)

NOTE:     The RTC has not at this point been updated. A cron job that runs at
          3:01 each morning will update the RTC from the System Clock if they
          differ by more than 30 minutes. The root user crontab entry that
          does this is:
1 3 * * * /etc/setclk -rd1800 > /dev/null 2>&1
NOTE:     If you run the command:
setclk -p
it may return
RTC 2008-03-09 02:00:16 STD
SYS 2008-03-09 03:00:15 DST  RTC-SYS=0

There is a bug in setclk that means that it can report either STD or DST and this may or may not be accurate. This has been reported to engineering as fz534673.

NOTE:     Because you are in Single User Mode, this cron job does not get
          executed. Because of this you will need to run the command:
/etc/setclk -rd1800

to update the RTC with the new localtime and to update the OFFSET in the /etc/rtc.data file.

To test that your system will switch from DST on November the 2nd 2008 at 2am in the morning do the following:

1) Reboot your server and set the RTC time in the Server BIOS to Sun Nov 2nd 01:55 2008. For details on how to set the RTC in your Server's BIOS please consult your server documentation.

2) Boot the server into Single User mode.

3) Run the date(C) command to display the time and date. The date(C) command should return a date similar to:

Sun Nov  2 01:57:50 PDT 2008

4) Wait until the time on the server reaches 2pm and again run the date command. If your TZ environment variable is configured correctly then the date reported should be similar to:

Sun Mar  9 01:00:05 PST 2008

You will know that you are no longer on DST because:

1) The time has gone back by one hour and

2) The date(C) command is reporting the TZ as PST (instead of PDT)

Once your testing is complete reboot your system into multi user mode and make sure you enter the correct time and date when prompted to by asktime(ADM).

From the Xinuos technical article database, record 126936. Reproduced with permission. The original is at www.sco.com/ta/126936, 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.