[Zope-dev] REPOST: Timezones

Martijn Pieters mj@antraciet.nl
Mon, 26 Apr 1999 16:10:31 +0200


At 01:33 24/04/99 , Robert Leftwich wrote:
>I am re-sending this mail as I have not received any replies, surely 
>somebody knows the answer.
>
>As I work in Australia I would like to add support for our timezones to the 
>DateTime/DateTimeZone files. Adding the data to DateTime.py is fine but can 
>anyone describe the format of the data in DateTimeZone.py as it somewhat 
>cryptic to say the least ?
>
>TIA
>Robert Leftwich
>
>

The DateTimeZone.py file lookes like a stringified database, probably not
intended for manual editing. You can however edit the _zmap and _zlist
variables in DateTime.py.

The trick is that most timezones are whole hour offsets to GMT, and the
DateTimeZone database does support these timezones. You'll only have to
tell DateTime.py exactly what offset your abbreviation entails.

The variable _zmap does just that, it provides a mapping between a
(lowercase) timezone name, and a DateTimeZone database entry. _zlist lists
all recognized timezones, in proper capitalisation. So, to add WAST, WADT,
EAST and EADT zones to DateTime, add the following to the _zmap variable:
'wadt':'GMT+8', 'eadt':'GMT+11', 'wast':'GMT+7', 'east':'GMT+10',
and the following to _zlist:
'WADT','WAST','EADT','EAST',
then at least those timezones are recognized.

I do not (yet) know how to add timezones that are not whole hour offsets to
GMT. I thing these will have to be added to DateTimeZone.py (by DC....)

I have submitted a patch to the latest CVS version of DateTime to the
Collector, which adds a whole list of well know timezones to DateTime, all
whole hour offsets.


--
Martijn Pieters, Web Developer
| Antraciet http://www.antraciet.nl
| Tel: +31-35-6254545 Fax: +31-35-6254555
| mailto:mj@antraciet.nl http://www.antraciet.nl/~mj
| PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149
------------------------------------------