[ZCM] [ZC] 484/ 7 Resolve "DateTime with January, 1st, 1970"
Collector: Zope Bugs, Features,
and Patches ...
zope-coders-admin at zope.org
Fri Jan 2 05:28:32 EST 2004
Issue #484 Update (Resolve) "DateTime with January, 1st, 1970"
Status Resolved, Zope/bug medium
To followup, visit:
http://collector.zope.org/Zope/484
==============================================================
= Resolve - Entry #7 by ajung on Jan 2, 2004 5:28 am
Status: Pending => Resolved
closing on request
________________________________________
= Comment - Entry #6 by yuppie on Jan 2, 2004 5:21 am
Checked in a fix to Zope-2_7-branch and HEAD. Could someone please close this issue?
________________________________________
= Comment - Entry #5 by yuppie on Jan 25, 2003 6:36 am
Same error with 1914/01/01 and 1942/01/01.
I had again a look at this. I tracked it down to a bug in _calcTimezoneName.
yr = ((yr - 1970) % 28) + 1970
This line should make sure we are in a save range, but 1970/01/01 isn't save. nearTime could again be negative.
I think we could savely asume on 1969/12/31 were no timezone changes.
So I propose to replace the second try (not the first one) for
ltm = safelocaltime(nearTime)
with something like
ltm = safelocaltime( max(0, nearTime) )
________________________________________
= 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.
==============================================================
More information about the Zope-Collector-Monitor
mailing list