develooper Front page | perl.datetime | Postings from January 2007

$TZ parsing

From:
Zefram
Date:
January 30, 2007 04:00
Subject:
$TZ parsing
Message ID:
20070130115949.GA10819@fysh.org
Summary of <20070124145636.GA29261@fysh.org>: various parsers of $TZ
allow these syntaxes:

glibc  Olson Solaris HP-UX  DT:TZ
  y0     y      y      y      n    <systemv>
  y0     n      n      y      n    :<systemv>
  y      y      y      n      n    /<filename>
  y      y      y      n      n    :/<filename>
  y      y      y      n      y    <olson>
  y      y      y      n      n    :<olson>
  n      n      n      n      y    floating
  n      n      n      n      y    Z
  n      n      n      n      n1   <offset>

Note 0: glibc does a subset of POSIX-extended SysV syntax, not the
whole thing.

Note 1: looks like DT::TZ might have been meant to accept an offset
here, but in fact it is rejected.  An offset is accepted in the "name"
constructor argument, but not in $TZ.

The handling of leading ":" is interesting.  All the parsers that
accept it at all have at least one syntax that is accepted both with and
without it.  So, although POSIX specifies it as introducing completely
implementation-defined syntax, the tendency is for it to allow a different
subset of syntaxes; the discernible meaning of a $TZ string is unaffected
by a leading ":".

I think generally DT::TZ would be better if it parsed $TZ in a manner
more like the various libcs.  At the moment the Olson names are the
only syntax that it has in common with them.  As I've mentioned, I'm
developing modules that will handle SysV syntax and tzfiles, so these
could be used to parse the other kinds of $TZ string.  I think a leading
":" should also be accepted and ignored, for compatibility with the
libcs that accept it for some syntaxes.

-zefram



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About