How to Setup the TZ Variable in the Config.sys File

From OS2World.Com Wiki
Jump to navigation Jump to search

This variable is used to describe the timezone information that the locale will use. To set TZ, use the SET which has the following format:

>>--SET--TZ--=--SSS---------------------------->
                     ------h-----------------
                      -+-     -:--m---------  
                      ---            -:--s-    
>----------------------------------------------><
   -DDD-----------------------------------
          -,sm,sw,sd,st,em,ew,ed,et,shift-

The values for the TZ variable are defined below. The default values given are for the built-in "C" locale defined by the ANSI C standard.

Table 1. TZ Environment Variable Parameters
VARIABLE DESCRIPTION DEFAULT
SSS Standard-timezone identifier. It must be three characters, must begin with a letter, and can contain spaces. EST
h, m, s optionally use m to specify minutes after the hour, and s to specify seconds after the minute. A positive number denotes time zones west of the Greenwich meridian; a negative number denotes time zones east of the Greenwich meridian. The number must be an integer value. 5
DDD Daylight saving time (DST) zone identifier. It must be three characters, must begin with a letter, and can contain spaces. EDT
sm Starting month (1 to 12) of DST. 4
sw Starting week (-4 to 4) of DST. Use negative numbers to count back from the last week of the month (-1) and positive numbers to count from the first week (1). 1
sd Starting day of DST.
0 to 6 if sw != 0
1 to 31 if sw = 0
0
st Starting time (in seconds) of DST. 3600
em Ending month (1 to 12) of DST. 10
ew Ending week (-4 to 4) of DST. Use negative numbers to count back from the last week of the month (-1) and positive numbers to count from the first week (1). -1
ed Ending day of DST.
0 to 6 if ew != 0
1 to 31 if ew = 0
0
et Ending time of DST (in seconds). 7200
shift Amount of time change (in seconds). 3600

For example:

SET TZ=CST6CDT

sets the standard time zone to CST, the daylight saving time zone to CDT, and sets a difference of 6 hours between CST and CUT. It does not set any values for the start and end date of daylight saving time or the time shifted.

When TZ is not present, the default is EST5EDT, the "C" locale value. When only the standard time zone is specified, the default value of n (difference in hours from GMT) is 0 instead of 5.

{*** Note: This paragraph **** }
 *** If you give values for any of sm, sw, sd, st, em, ew, ed, et, or shift, you
 *** must give values for all of them. the entire statement is considered not
 *** valid, and the time zone information is not changed. 

{For C/C++ programming}
 The value of TZ can be accessed and changed by the tzset function. For more
 information on tzset, see the C Library Reference. 

Some further comments:

 Note that the above Marked paragraph says:
 "ALL values for of ... must be given for any to have any meaning."

The full Default value for TZ is

SET TZ=EST5EDT,4,1,0,3600,10,-1,0,7200,3600

And it's meaning in a more non-programmer format:

 TZ repesentation ............ = EST+5EDT,4,1,0,3600,10,-1,0,7200,3600
 Standard string ............. = EST
 Offset from UTC (seconds) ... = -05:00:00 (-18000)
 Daylight savings string ..... = EDT
 Daylight savings is ......... = Observed
   Start information ......... = 4,1,0,3600
     Month ................... =   4 April
     Week of month ........... =   1 from the beginning of month
     Day of week ............. =   0 Sunday
     Time of day ............. =  01:00:00 (3600)
     Starts this year ........ = Sun,  7 Apr 1996 01:00:00
   End information ........... = 10,-1,0,7200
     Month ................... =  10 October
     Week of month ........... =  -1 from the end of month
     Day of week ............. =   0 Sunday
     Time of day ............. =  02:00:00 (7200)
     Ends this year .......... = Sun, 27 Oct 1996 02:00:00
   Difference is ............. = +01:00:00 (3600)