TZ-related changes in Draft 5 of the next POSIX standard

Paul Eggert eggert at
Tue Jan 9 00:31:46 UTC 2001

The Austin Common Standards Revision Group is drafting the next
revision of POSIX, and Draft 5 (d5) is now available; see

Here are some tz-related changes in this draft:

* The TZ string has been extended to allow time zone abbreviations
  with +, -, and digits, so long as the abbreviations are quoted by
  angle brackets.  For example, the Bourne shell commands

    TZ='<UTC+10>-10' date; date -u

  might output the following text:
    Tue Jan  9 10:30:19 UTC+10 2001
    Tue Jan  9 00:30:19 GMT 2001

* Conforming time zone abbreviations are no longer allowed to contain
  arbitrary characters.  Unquoted abbreviations can contain only
  alphabetic characters in the current locale; quoted ones can also
  contain digits, '+', and '-'.

* Multibyte characters are explicitly allowed in time zone
  abbreviations, e.g. TZ='AB at -10' might specify an abbreviation 'AB at -'
  if '@-' is a valid multibyte character in the current locale.

* The following declarations are added to <time.h>:

  char *asctime_r(const struct tm *restrict, char *restrict);
  char *ctime_r(const time_t *, char *);
  struct tm *localtime_r(const time_t *restrict, struct tm *restrict);
  struct tm *gmtime_r(const time_t *restrict, struct tm *restrict);              struct tm *getdate(const char *);
  char *strptime(const char *restrict, const char *restrict,
    struct tm *restrict);

  extern int daylight;
  extern long timezone;

* The following declaration is added to <wchar.h>, as per ISO C99:

  size_t wcsftime(wchar_t *restrict wcs, size_t maxsize,
    const wchar_t *restrict format, const struct tm *restrict timptr);

Here is the TZ-environment-variable-relevant part of the text that has
changed; this covers the first three items mentioned above.  I have
included change bars in the text quoted below.  The unchanged part
appears in section 8.1.1 of the current POSIX standard.
    The expanded format (for all TZs whose value does not have a colon as
    the first character) is as follows:



    std and dst

       Indicate no less than three, nor more than {TZNAME_MAX},
       bytes that are the designation for the standard (std) or the
       alternative (dst-such as Daylight Savings Time) timezone. Only
       std is required; if dst is missing, then the alternative time does
       not apply in this locale.
   |   Each of these fields may occur in either of two formats quoted or
   |   unquoted:
   |    - In the quoted form, the first character shall be the less-than
   |      ('<') character and the last character shall be the
   |      greater-than ('>') character. All characters between these
   |      quoting characters shall be alphanumeric characters in the
   |      current locale, the plus-sign ('+') character, or the
   |      minus-sign ('-') character. The std and dst fields in this case
   |      do not include the quoting characters.
   |    - In the unquoted form, all characters in these fields shall be
   |      alphabetic characters in the current locale.
   |   The interpretation of these fields is unspecified if either field is
   |   less than three bytes (except for the case when dst is missing),
   |   more than {TZNAME_MAX} bytes, or if they contain characters
   |   other than those specified.

More information about the tz mailing list