Eryk Sun <[email protected]> added the comment:
mktime() is the inverse of localtime(). With the given format string,
strptime() sets tm_isdst to -1, for which mktime will use the system's timezone
information to determine whether or not it's daylight saving time. You need to
verify that the time zones are the same.
For me the results agree in Linux and Windows with the local timezone on both
systems set to the UK.
9 March (GMT, standard time)
Linux
>>> time.mktime(time.struct_time((2014, 3, 9, 2, 0, 0, 6, 68, 0)))
1394330400.0
>>> time.mktime(time.struct_time((2014, 3, 9, 2, 0, 0, 6, 68, -1)))
1394330400.0
Windows
>>> time.mktime(time.struct_time((2014, 3, 9, 2, 0, 0, 6, 68, 0)))
1394330400.0
>>> time.mktime(time.struct_time((2014, 3, 9, 2, 0, 0, 6, 68, -1)))
1394330400.0
9 August (BST, daylight saving time)
Linux
>>> time.mktime(time.struct_time((2014, 8, 9, 2, 0, 0, 6, 68, 1)))
1407546000.0
>>> time.mktime(time.struct_time((2014, 8, 9, 2, 0, 0, 6, 68, -1)))
1407546000.0
Windows
>>> time.mktime(time.struct_time((2014, 8, 9, 2, 0, 0, 6, 68, 1)))
1407546000.0
>>> time.mktime(time.struct_time((2014, 8, 9, 2, 0, 0, 6, 68, -1)))
1407546000.0
----------
nosy: +eryksun
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue31646>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com