timezone configuration patch
Michael M Slusarz
slusarz@bigworm.colorado.edu
Mon, 13 Aug 2001 19:10:52 -0600
All,
Yet another hack from me :) This time I grew tired of waiting for a timezone
drop-down menu implementation to be done so I did it myself.
Diffs/new files/pictures of the hack in action can be found at:
http://bigworm.colorado.edu/imp-patches/timezone.php
A few things I discovered while putting it together:
1. A string of the form [+-]0200 ([+-]hours difference from GMT) does NOT
appear to work at all. I'm using a Linux system, and if you put anything in
this form and send a message it appears that whatever is using the TZ
environment variable (sendmail/postfix/qmail ??) will just ignore it and your
message will be sent with time -0000 GMT.
2. This is because the correct POSIX.1 TZ implementation is:
STDoffset[DST[offset], (some other stuff...)]
where STD is the 3+ letter code for the time zone and
where DST is the 3+ letter code for the daylight time zone
Thus, the TZ variable must be something as follows:
EST5EDT
MST7MDT
etc.
This works fine for american timezones, but it turns out there is no
convention for worldwide timezone abbreviations, etc. Additionally, half-hour
deviations do not seem to work well. If you try IT-3:30 (Iran - 3hr 30min.),
it will say your mail message came from about a month ago and stuff. Plus, the
default DST rules are americanized and may not be correct for the rest of
world - and most likely isn't. Yuck.
3. Luckily, there is the POSIX.1 extensions of Country/City which handles all
of these problems. This convention handles all of the peculiarities that occur
in the same time zones (i.e. there are about 3-4 different time zone rules in
the state of Indiana alone). This is the way I have implemented my patch. A
nice thorough list of Country/City combinations can be downloaded from
ftp://elsie.nci.nih.gov/pub/. These are the timezone codes used by GNU/glibc
based systems. The only drawback is that I don't know if this will work on a
non GNU-like system (i.e Windows, Solaris). But this is as good as I think it
can get without implementing an entire timezone system in PHP.
The patch allows you to lock the timezone and set a default timezone (using the
normal syntax in imp/config/prefs.php).
Let me know if you have any questions/comments.
michael
_______________________________________________
Michael Slusarz [slusarz@bigworm.colorado.edu]
The University of Colorado at Boulder