zic.8 in html
Dave Rolsky
autarch at urth.org
Thu Oct 9 19:48:08 UTC 2003
On Thu, 9 Oct 2003, Oscar van Vlijmen wrote:
> Some non-Unix and even non-C developers would like to use the timezone data,
> but they cannot find nor read the documentation.
If anyone's interested, I've implemented a Perl module that provides a
Perl API to the timezone database. It parses the source text files and
generates Perl modules, rather than simply overlaying the C API, for a
number of reasons. The main reason was that I wanted this to work outside
the bounds of the epoch, so using native time_t values wouldn't work.
Anyway, the module is called DateTime::TimeZone, and is at
http://search.cpan.org/dist/DateTime-TimeZone/. It's part of a larger
project to provide decent date/time support for Perl. More info on the
project can be found at datetime.perl.org.
BTW, writing a parser for the TZ data was a bit of a nightmare, as the
interrelations between observance changes and rules make it very complex
to figure out what rule is in effect at any given time. I don't know if
there's a better way to represent this data, but explaining _how_ to do
this to someone who wants to write a parser is non-trivial. The zic.8
file doesn't really explain the "how", just the "what".
Also, to make sure I was doing this correctly, I wrote some code to
generate tests based on zdump's output. This is a script in the
DateTime::TimeZone distro called tools/tests_from_zdump. People working
on providing a non-C API may find this script useful, as it generates
comprehensive tests for _every_ zone for _every_ change that zdump
outputs. It could easily be adapted to generate tests for a different
language's API.
-dave
/*=======================
House Absolute Consulting
www.houseabsolute.com
=======================*/
More information about the tz
mailing list