TZ... Again (OT)

Simon Bowring pmmail@rpglink.com
Thu, 30 Mar 2000 19:09:13 +0100 (BST)


>     IIRC (which is sometimes up for grabs) this is because OS/2
>ignores anything after the offset in the 'TZ' environment setting.  It
>doesn't consider the longer string in error, but it doesn't do anything
>with it either.  If you look at the 'TZ' variable in the online help
>you'll also notice that only the offset is mentioned.

*OS/2* ignores TZ completely. Programs written in C and C++ use it!

TZ is parsed by the C/C++ run-time library which is shipped with C
compilers and is linked into ("becomes one with") the application program.  

It is possible that some programs parse TZ themselves directly and ignore 
the tail, but any programs using the C runtime library time functions 
properly will use the whole string

The documentation following is from from IBM C/C++.

[Sorry about the long lines, I just pasted this stuff
in.  If you use a proportional font, the syntax diagrams won't
make sense, but that's your fault, not mine ;-).  Maybe I should
have spent a couple of hours converting it to HTML <chuckle>]

Simon
--

 TZ
 
 This variable is used to describe the time zone information to be used by the locale.  
 It is set using the SET command, and has the following format: 
 
 +------------------------------------------------------------------------------+
 |                                                                              |
 | >>--SET--TZ--=--SSS--+------------------------------+----------------------> |
 |                      |                              |                        | 
 |                      +-+---+--h--+----------------+-+                        |
 |                        |   |     |                |                          |
 |                        + + +     +-:--m--+------+-+                          |
 |                        |   |             |      |                            |  
 |                        +-+-+             +-:--s-+                            |
 |                                                                              |
 | >--+--------------------------------------------+------------------------->< |
 |    |                                            |                            |
 |    |                                            |                            |  
 |    +-DDD--+-----------------------------------+-+                            |
 |           |                                   |                              |
 |           +-,sm,sw,sd,st,sm,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 VALUE   | 
 +--------------+---------------------------------------------+-----------------+
 | SSS          | Standard time zone identifier.  This must   | EST             | 
 |              | be three characters, must begin with a      |                 | 
 |              | letter, and can contain spaces.             |                 | 
 +--------------+---------------------------------------------+-----------------+
 | h, m, s      | The variable h specifies the difference (in | 5               | 
 |              | hours) between the standard time zone and   |                 | 
 |              | coordinated universal time (CUT), formerly  |                 | 
 |              | Greenwich mean time (GMT).  You can         |                 | 
 |              | 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.                           |                 | 
 +--------------+---------------------------------------------+-----------------+
 | DDD          | Daylight saving time (DST) zone identifier. | EDT             | 
 |              | This must be three characters, must begin   |                 | 
 |              | with a letter, and can contain spaces.      |                 | 
 +--------------+---------------------------------------------+-----------------+
 | sm           | Starting month (1 to 12) of DST.            | 4               | 
 +--------------+---------------------------------------------+-----------------+
 | sw           | Starting week (-4 to 4) of DST.  Use nega-  | 1               | 
 |              | tive numbers to count back from the last    |                 | 
 |              | week of the month (-1) and positive numbers |                 | 
 |              | to count from the first week (1).           |                 | 
 +--------------+---------------------------------------------+-----------------+
 | sd           | Starting day of DST.                        | 0               | 
 |              | 0 to 6 if sw != 0                           |                 | 
 |              | 1 to 31 if sw = 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 | -1              |
 |              | numbers to count back from the last week of |                 | 
 |              | the month (-1) and positive numbers to      |                 | 
 |              | count from the first week (1).              |                 | 
 +--------------+---------------------------------------------+-----------------+
 | ed           | Ending day of DST.                          | 0               | 
 |              | 0 to 6 if ew != 0                           |                 | 
 |              | 1 to 31 if ew = 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. 

 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. If any of these values is not valid, the entire 
 statement is considered not valid, and the time zone information is not changed. 

 The value of TZ can be accessed and changed by the _tzset function.  See the C 
 Library Reference for more information on _tzset.