[Zope-dev] DateTime class not recognizing timezone correctly...

Steve Spicklemire steve@spvi.com
Sun, 08 Jul 2001 11:58:40 -0500


Hi -dev folk.. 

I ha(d) a problem where DateTime was basing the local timezone on
time.tzname, and getting it wrong. (tzname comes from the abbreviation,
which in Indiana is 'EST', but DateTime really wants 'US/East-Indiana'.
So.. I patched DateTime as follows.. I saw a proposal in the archives
about this kind of solution. Any other ideas? How are other folks
handling this?

thanks,
-steve

diff DateTime.py myDateTime.py
96,97c96,107
< try: from time import tzname
< except: tzname=('UNKNOWN','UNKNOWN')
---
> 
> tzname = None
> try:
>     from localzoneinfo import tzname
> except:
>     pass
> 
> try:
>     if tzname is None:
>         from time import tzname
> except:
>     tzname=('UNKNOWN','UNKNOWN')