Operating System - HP-UX
1832978 Members
2634 Online
110048 Solutions
New Discussion

Re: TZ environment variable and daylight savings

 
Robert Lee_2
New Member

TZ environment variable and daylight savings

The environ man page states:

TZ sets time zone information. TZ can be set using the
format:

[:]STDoffset[DST[offset][,rule]]

rule rule indicates when to change to and
from summer (daylight-savings) time.
The rule has the form :

date/time,date/time

At what time will the system add or subtract and the hour if the rule parameter is blank?
Such as the case were TZ=PST8PDT

At 2:00am or midnight?

6 REPLIES 6
Elizabeth_2
Valued Contributor

Re: TZ environment variable and daylight savings


Hi Robert,

In the tztab for TZ=PST8PDT you need to look at:

# Pacific Standard Time, Pacific Daylight Time
PST8PDT
0 3 24-30 4 1970-1973 0 PDT7
0 3 6 1 1974 0-6 PDT7
0 3 22-28 2 1975 0 PDT7
0 3 24-30 4 1976-1986 0 PDT7
0 3 1-7 4 1987-2038 0 PDT7
0 1 25-31 10 1970-1973 0 PST8
0 1 24-30 11 1974 0 PST8
0 1 25-31 10 1975-2038 0 PST8

The lines contain seven fields each. The first six fields specify the first minute in which the time zone adjustment, specified in the seventh field, applies. The fields are separated by spaces or tabs. The first six are integer patterns that specify the minute (0-59), hour (0-23), day of the month (1-31), month of the year (1-12), year (1970-2038), and day of the week (0-6, with 0=Sunday). The minute, hour, and month of the year must contain a number in the (respective) range indicated above. The day of the month, year, and day of the week can contain a number as above or two numbers separated by a minus (indicating an inclusive range). Either the day of the month or the day of the week field must be a range, the other must be simple number.

So based on this entry:

0 1 25-31 10 1975-2038 0 PST8

The exact switchover for this year happens on Sunday, October 29th (Sunday between the dates 25-21) at 1:00am.

Robert Lee_2
New Member

Re: TZ environment variable and daylight savings

Let me make sure I understand this. If the rule is not defined when the TZ variable is intialized, then the the daylight saving time transition occurs at the time listed in the tztab file.

The the second field of the tztab has the hour set to 1:00 am and DST starts at 2:00 am (http://webexhibits.org/daylightsaving/b.html). If this is the case wouldn't the clock be out of sync for an hour?

Thanks


Elizabeth_2
Valued Contributor

Re: TZ environment variable and daylight savings


Hi Robert,

It does appear that way. All I am positive about is that yes- the daylight saving time transition occurs at the time listed in the tztab file. Sorry that I couldn't provide you with more usefule information.
Dan Hetzel
Honored Contributor

Re: TZ environment variable and daylight savings

Hi Robert,

The following line has already been explained by Elizabeth.
0 1 25-31 10 1975-2038 0 PST8

Ont point to keep in mind is that it shows the hour (in this case 01:00AM) that we should use AFTER we return back to "winter"
time on Sunday 29 this year. Which is correct because we went back from 02:00AM to 01:00AM.
The same applies for Daylight saving Time, it shows 03:00 AM because we adjusted our
clocks from 02:00AM to 03:00 AM

Best regards,

Dan

PS:
0 1 25-31 10 1975-2038 0 PST8
^^^^^ ^
the range being 7 days inclusive and the day of the week being a sunday (0), this should be read as "the last Sunday of the month"


Everybody knows at least one thing worth sharing -- mailto:dan.hetzel@wildcroft.com
Dan Hetzel
Honored Contributor

Re: TZ environment variable and daylight savings

Oops,

I forgot that a proportional font was used..
The carets don't align properly.
They should be under "25-31" and the last "0"

Dan
Everybody knows at least one thing worth sharing -- mailto:dan.hetzel@wildcroft.com
Robert Lee_2
New Member

Re: TZ environment variable and daylight savings

Elizabeth stated:

So based on this entry:

0 1 25-31 10 1975-2038 0 PST8

The exact switchover for this year happens on Sunday,October 29th (Sunday between the dates 25-21) at 1:00am.

Dan stated:
The following line has already been explained by Elizabeth.

0 1 25-31 10 1975-2038 0 PST8

One point to keep in mind is that it shows the hour (in this case 01:00AM) that we should use AFTER we return back to "winter"

So Elizabeth was incorrect the transition occurs at 2:00 am. The second column is the time the clock is set to after the daylight saving time transition. So what should happen is that at 2:00 am the date command reports the time as 1:00 am.

If I set the system day to 1029015900, and observe the system date by envoking the
date command every ten seconds. When the 2:00 am transtion occurs the date command reports 2:00 am and does not roll back to 1:00am. This is a problem.


Are there any documents beside the man page that state how HP -UX 10.20 handles
time and date transition such as daylight savings and leap year?