FW: Question on TZ data

Paul Eggert eggert at twinsun.com
Fri Oct 13 05:02:16 UTC 2000


> From: mikec at imeeting.net [mailto:mikec at imeeting.net]
> Sent: Thursday, October 12, 2000 9:47 PM

> Is there source code on the web that will product a concise listing of each
> timezone and it's most recently observed start and end times for DST and /

The closest approximation that I know of is the GNU Emacs Lisp
function calendar-current-time-zone which I co-wrote with Ed Reingold.
For example, on my host (in Los Angeles) it returns:

   (-480 60 "PST" "PDT"
    (calendar-nth-named-day 1 0 4 year)
    (calendar-nth-named-day -1 0 10 year)
    120 120)

which says that standard time is 480 minutes behind UTC, DST is 60
minutes ahead of standard time, the standard and daylight
abbreviations are "PST" and "PDT" respectively, and DST starts on the
first Sunday in April and ends on the last Sunday in October, both at
120 minutes after midnight local time.

calendar-current-time-zone infers the DST rules purely by invoking
localtime and gmtime; it doesn't have a database of its own, and it
doesn't parse the tz database format.  It uses heuristics, so it won't
always give you the right results in theory, though in practice it's
pretty reliable.  E.g. it does the right thing for TZ=Asia/Tehran
because it knows about the Persian calendar.

This function should give you the raw material to write the program
that you want, without too much trouble.  And the source code is
freely available under the GPL, so if you prefer using some system
other than GNU Emacs Lisp you can translate it.



More information about the tz mailing list