[ZCM] [ZC] 740/ 2 Comment "_tzoffset returns wrong offset"
Collector: Zope Bugs, Features, and Patches ...
zope-coders-admin@zope.org
Sat, 21 Dec 2002 08:32:14 -0500
Issue #740 Update (Comment) "_tzoffset returns wrong offset"
Status Pending, Zope/bug+solution medium
To followup, visit:
http://collector.zope.org/Zope/740
==============================================================
= Comment - Entry #2 by vlpast on Dec 21, 2002 8:32 am
In fact, it should be written as:
return int(tz[0:3])*3600+int(tz[0]+tz[3:5])*60
to correctly handle minute part.
________________________________________
= Request - Entry #1 by vlpast on Dec 21, 2002 8:25 am
_tzoffset() returns negative offset for timezone names written like '+0200' because the first character is not being taken into account.
Example:
>>> from DateTime.DateTime import _tzoffset
>>> _tzoffset('GMT+0200', time())
7200
>>> _tzoffset('+0200', time())
-7200
Proposed solution:
in _tzoffset definition (DateTime.py) the line
return -int(tz[1:3])*3600-int(tz[3:5])*60
should be changed to
return int(tz[0:3])*3600-int(tz[3:5])*60
==============================================================