[ python-Bugs-1656559 ] I think, I have found this bug on time.mktime()

SourceForge.net noreply at sourceforge.net
Tue Feb 13 12:06:47 CET 2007


Bugs item #1656559, was opened at 2007-02-10 03:41
Message generated for change (Comment added) made by sergiomb
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1656559&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Closed
Resolution: Works For Me
Priority: 5
Private: No
Submitted By: Sérgio Monteiro Basto (sergiomb)
Assigned to: Nobody/Anonymous (nobody)
Summary: I think, I have found this bug on time.mktime()

Initial Comment:
well, I think, I have found this bug on time.mktime() for dates less
than 1976-09-26

when I do stringtotime of 1976-09-25 

print "timeint %d" % time.mktime(__extract_date(m) + __extract_time(m) + (0, 0, 0)) 

extract date = 1976 9 25
extract time = 0 0 0
timeint 212454000
and 
timetostring(212454000) = 1976-09-24T23:00:00Z !? 

To be honest the date that kept me the action was the 1-1-1970 that
appears 31-12-1969. After timetostring(stringtotime(date)))

I made the test and time.mktime got a bug when date is less than
1976-09-26 
see:
for 1976-09-27T00:00:00Z time.mktime gives 212630400
for 1976-09-26T00:00:00Z time.mktime gives 212544000
for 1976-09-25T00:00:00Z time.mktime gives 212454000

212630400 - 212544000 = 86400 (seconds) , one day correct !
but
212544000 - 212454000 = 90000 (seconds), one day more 3600 (seconds),
more one hour ?!? 
    
--
Sérgio M. B. 



----------------------------------------------------------------------

>Comment By: Sérgio Monteiro Basto (sergiomb)
Date: 2007-02-13 11:06

Message:
Logged In: YES 
user_id=4882
Originator: YES

here with ubuntu 6.10 with python 2.4.4c1 
>>> import time
>>>
time.mktime((1976,9,26,0,0,0,0,0,0))-time.mktime((1976,9,25,0,0,0,0,0,0))
90000.0

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2007-02-13 05:57

Message:
Logged In: YES 
user_id=21627
Originator: NO

Looks like an FC6 bug to me (either in their C library, or in their Python
port). On Debian 3.1, Python 2.4.1, I also get 86400.0. Please report this
to Redhat; I'm closing this as "works for me". If you stil think there is a
bug in Python, please point to the exact source that you think is
erroneous, and the change that should be made.

----------------------------------------------------------------------

Comment By: Sérgio Monteiro Basto (sergiomb)
Date: 2007-02-12 22:37

Message:
Logged In: YES 
user_id=4882
Originator: YES

python-2.4.4-1.fc6
>>> import time
>>>
time.mktime((1976,9,26,0,0,0,0,0,0))-time.mktime((1976,9,25,0,0,0,0,0,0))
90000.0


----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2007-02-12 12:38

Message:
Logged In: YES 
user_id=21627
Originator: NO

I can't reproduce this problem. On my system (OSX), I get

>>>
time.mktime((1976,9,26,0,0,0,0,0,0))-time.mktime((1976,9,25,0,0,0,0,0,0))
86400.0

What system are you using? What Python version? What timezone are you in?

----------------------------------------------------------------------

Comment By: Georg Brandl (gbrandl)
Date: 2007-02-10 15:06

Message:
Logged In: YES 
user_id=849994
Originator: NO

This appears to be a timezone/DST issue:
on Sept. 26, 1976 Daylight Saving Time ended at least in the European
Union.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1656559&group_id=5470


More information about the Python-bugs-list mailing list