DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

timezone(F)


timezone -- set default system time zone

Format

TZ='STZrel1[LDT[rel2]][,start[/starttime],end[/endtime]]'
export TZ

Description

The /etc/TIMEZONE file sets and exports the time zone environmental variable TZ.

The TZ variable is assigned a string formatted as shown in the ``Format'' section. The fields are:


STZ
One to nine letters designating the standard time zone.

rel1
Number of hours past Greenwich mean time for the standard time (partial hours are valid, for example 12:30:01). Positive hours are west of Greenwich, negative numbers are east of Greenwich.

LDT
One to nine letters designating the local daylight savings time (summer time) zone. If not present, summer time is assumed not to apply.

rel2
Number of hours past Greenwich mean time for the summer time (partial hours are valid, for example 11:30:01). Positive hours are west of Greenwich, negative numbers are east of Greenwich. If rel2 is not given, the distance to GMT during summer time is assumed to be one hour less than during standard time.

start
The rule defining the day summer time begins. In the southern hemisphere, the ending day will be earlier in the year than the starting day.

starttime
The time of day the change to summer time occurs. The default is 02:00:00 local time.

end
The rule defining the day summer time ends.

endtime
The time of day the change from summer time occurs. The default is 02:00:00 local time.

Four different rules are available for defining the start and end of summer time:


n
given day of the year with January 1 as day 0;
0 based Julian day n (0 LESS THAN OR EQUAL TO n LESS THAN OR EQUAL TO 364) *

Jn
given day of the year with January 1 as day 1;
1 based Julian day n (1 LESS THAN OR EQUAL TO n LESS THAN OR EQUAL TO 365) *

Wn[.d]
given week and day;
day d (0 LESS THAN OR EQUAL TO d LESS THAN OR EQUAL TO 6)** of week n (1 LESS THAN OR EQUAL TO n LESS THAN OR EQUAL TO 53) +

Mm.n.d
given month, week, and day;
day d of week n (1 LESS THAN OR EQUAL TO n LESS THAN OR EQUAL TO 5) ++ of month m (1 LESS THAN OR EQUAL TO m LESS THAN OR EQUAL TO 12)


*
Leap days (February 29) are never counted; that is, February 28 (J59) is immediately followed by March 1 (J60) even in leap years.

**
Sunday is the first day of the week (0). If d is omitted, Sunday is assumed. Note that d is optional.

+
The 5th week of the month is always the last week containing day d, whether there are actually 4 or 5 weeks containing day d.

++
The 53rd week of the year is always the last week containing day d, whether there are actually 52 or 53 weeks containing day d.

If start and end are omitted, current U.S. law is assumed.

Examples

A simple setting for New Jersey could be
   TZ='EST5EDT'
where ``EST'' is the abbreviation for the main time zone, ``5'' is the difference, in hours, between GMT (Greenwich Mean Time) and the main time zone, and ``EDT'' is the abbreviation for the alternate time zone.

The most complex representation of the same setting, for the year 1986, is

   TZ='EST5:00:00EDT4:00:00,117/2:00:00,299/2:00:00'
where ``EST'' is the abbreviation for the main time zone, ``5:00:00'' is the difference, in hours, minutes, and seconds between GMT and the main time zone, ``EDT'' is the abbreviation for the alternate time zone, ``4:00:00'' is the difference, in hours, minutes, and seconds between GMT and the alternate time zone, ``117'' is the number of the day of the year (0 based Julian day) when the alternate time zone will take effect, ``2:00:00'' is the number of hours, minutes, and seconds past midnight when the alternate time zone will take effect, ``299'' is the number of the day of the year when the alternate time zone will end, and ``2:00:00'' is the number of hours, minutes, and seconds past midnight when the alternate time zone will end.

A southern hemisphere setting such as the Cook Islands could be

   TZ='KDT9:30KST10:00,64/5:00,303/20:00'
This setting means that ``KDT'' is the abbreviation for the main time zone, ``KST'' is the abbreviation for the alternate time zone, KST is 9 hours and 30 minutes later than GMT, KDT is 10 hours later than GMT, the starting date of KDT is the 64th day at 5 AM, and the ending date of KDT is the 303rd day at 8 PM.

Starting and ending times are relative to the alternate time zone. If the alternate time zone start and end dates and the time are not provided, the days for the United States that year will be used and the time will be 2 AM. If the start and end dates are provided but the time is not provided, the time will be midnight.

Note that in most installations, TZ is set to the correct value by default when the user logs on, via the local /etc/profile file (see profile(M)).

Limitations

Setting the time during the interval of change from the main time zone to the alternate time zone or vice versa can produce unpredictable results.

The Wn.[d] format for defining the start and end dates of daylight savings time in the TZ environment variable is not recognized by tzset(S). To work around this limitation, use one of the other formats, such as Mm.n.d, to set the limits of DST in TZ.

See also

ctime(S), environ(M), profile(M), rc2(ADM), tz(M)

Standards conformance

timezone is conformant with X/Open Portability Guide, Issue 3, 1990.
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003