[issue10102] mktime adding an hour in April (naive struct)?

Kevin Barnhart report at bugs.python.org
Thu Oct 14 16:08:05 CEST 2010


New submission from Kevin Barnhart <barnburnr at gmail.com>:

Just starting to dabble in the world of time and datetime objects.  I was converting an array of datetime objects to an array of floats via mktime to do some data analysis.  I have ran into an issue where mktime seems to be adding an hour on April 6, 2003.  Attached is an example script which I used to create the below output:

Python version:  (2, 6, 5, 'final', 0)
Epoch:  time.struct_time(tm_year=1970, tm_mon=1, tm_mday=1, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=3, tm_yday=1, tm_isdst=0)
First datetime:  2003-04-06 02:58:17
Second datetime:  2003-04-06 03:13:17
Is first datetime prior to second?:  True
First datetime, time struct: time.struct_time(tm_year=2003, tm_mon=4, tm_mday=6, tm_hour=2, tm_min=58, tm_sec=17, tm_wday=6, tm_yday=96, tm_isdst=-1)
Second datetime, time struct: time.struct_time(tm_year=2003, tm_mon=4, tm_mday=6, tm_hour=3, tm_min=13, tm_sec=17, tm_wday=6, tm_yday=96, tm_isdst=-1)
Is first time struct prior to second?:  True
First timestamp generated by mktime:  1049623097.0
Second timestamp generated by mktime:  1049620397.0
Is first timestamp less than second timestamp?:  False
First recovered datetime:  2003-04-06 03:58:17
Second recovered datetime:  2003-04-06 03:13:17
Is first recovered prior to second recovered?:  False
Is first recovered datetime same as original?:  False
Is second recovered datetime same as original?:  True

----------
files: mktimeissue.py
messages: 118662
nosy: barnburnr
priority: normal
severity: normal
status: open
title: mktime adding an hour in April (naive struct)?
type: behavior
Added file: http://bugs.python.org/file19232/mktimeissue.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10102>
_______________________________________


More information about the Python-bugs-list mailing list