[ZCM] [ZC] 740/ 3 Assign "_tzoffset returns wrong offset"
Collector: Zope Bugs, Features, and Patches ...
zope-coders-admin@zope.org
Thu, 16 Jan 2003 09:21:02 -0500
Issue #740 Update (Assign) "_tzoffset returns wrong offset"
Status Accepted, Zope/bug+solution medium
To followup, visit:
http://collector.zope.org/Zope/740
==============================================================
= Assign - Entry #3 by regebro on Jan 16, 2003 9:20 am
Status: Pending => Accepted
Supporters added: regebro
You seem indeed to be correct. This will be fixed in Zope 2.6.1 and later.
________________________________________
= 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
==============================================================