Technical article 105119

date(C) behaves differently on OpenServer 5.0 when using a Daylight Savings TZ.

OpenServer 5.0.0

Written · Last revised

Problem

I have set my time zone variable as follows:

$ TZ='MET-1METDST,M3.5.0/2,M9.5.0/2'
$ export TZ

In this example, the Middle European time zone is specified, one hour east of GMT, which changes to Daylight Savings time at 2:00 A.M. on the last Sunday in March, and back again at 2:00 A.M. on the last Sunday in September.

If the following is then run:
$ date 09290159

on SCO UNIX Version 4.2 or SCOOpen Server 3.0, this is displayed:

Sun Sep 29 01:59:00 MET 1996

However, on SCO OpenServer 5.0, the following is displayed:

Sun Sep 29 01:59:00 METDST 1996

Cause

This occurs because 01:59 on the last Sunday in September is an "ambiguous" time, that is:

      01:59 (AM) MET
and
      01:59 (AM) METDST

are both valid times on that day.

On SCO UNIX Version 4.2 or SCOOpen Server 3.0, it is not possible
to specify the time zone to date(C).  It will default to the
non-Daylight Savings time zone.

SCO OpenServer 5.0 date(C) defaults to the Daylight Savings time zone.

Solution

For consistent behavior between releases, always set the time with date(C), with TZ set to a non-Daylight Savings time zone.

Using the above example:
$ TZ=MET-1
$ export TZ
$ date <date>

where <date> is a valid date format parameter.

NOTE:     date(C) on SCO OpenServer 5.0 has a "-u" parameter which forces
          it to set the date relative to GMT, regardless of what TZ is set
          to.

See also

date(C) timezone(F)

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