[ZCM] [ZC] 484/ 4 Comment "DateTime with January, 1st, 1970"

Collector: Zope Bugs, Features, and Patches ... zope-coders-admin@zope.org
Fri, 17 Jan 2003 06:36:50 -0500


Issue #484 Update (Comment) "DateTime with January, 1st, 1970"
 Status Pending, Zope/bug medium
To followup, visit:
  http://collector.zope.org/Zope/484

==============================================================
= Comment - Entry #4 by regebro on Jan 17, 2003 6:36 am

Sorry, my fault, I didn't see the first line with the >>> thingies. :)
________________________________________
= Comment - Entry #3 by regebro on Jan 17, 2003 6:35 am

SOme examplecode if how to get this error would be nice. Then it might be possible to fix it.
________________________________________
= Comment - Entry #2 by yuppie on Nov 26, 2002 4:52 pm

Additional information from Dieter:

 > This problem normally just appears east of the Atlantic Ocean:
and only on Windows...

This is a bug in the Windows "C" library function "localtime"
which is unable to handle negative parameters.
________________________________________
= Request - Entry #1 by yuppie on Jul 22, 2002 1:38 pm

To reproduce this problem, your machine's timezone has to be GMT+X !

>>> print DateTime('1970/01/01')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "DateTime\DateTime.py", line 650, in __init__
    yr,mo,dy,hr,mn,sc,tz=self._parse(arg)
  File "DateTime\DateTime.py", line 1031, in _parse
    tz = self._calcTimezoneName(x, ms)
  File "DateTime\DateTime.py", line 850, in _calcTimezoneName
    ltm = safelocaltime(nearTime)
  File "DateTime\DateTime.py", line 400, in safelocaltime
    rval = localtime(t_int)
IOError: [Errno 22] Invalid argument

This works (timezone GMT+1):

>>> print DateTime('1970/01/01 01:00:00')
1970/01/01 01:00:00 GMT+1

Didn't debug this, but it seems to me that nearTime in _calcTimezoneName() is a value calculated for GMT.
This is the same bug as rejected issue 190. I think ajung couldn't reproduce it with his timezone setting.
==============================================================