[New-bugs-announce] [issue33579] calendar.timegm not always an inverse of time.gmtime

Eitan Adler report at bugs.python.org
Sat May 19 06:41:39 EDT 2018


New submission from Eitan Adler <lists at eitanadler.com>:

How to reproduce:
∴cat bad.py
import time
import calendar

one = time.gmtime(1234567899)
two = calendar.timegm(time.gmtime(1234567899))
three = time.gmtime(two)

print(one)
print(two)
print(three)
print(one == three)


Expected behavior:
the functions behave as documented: they are inverses


Actual behavior:

∴/srv/src/python/cpython/python bad.py
time.struct_time(tm_year=2009, tm_mon=2, tm_mday=13, tm_hour=23, tm_min=31, tm_sec=15, tm_wday=4, tm_yday=44, tm_isdst=0)
1234567875
time.struct_time(tm_year=2009, tm_mon=2, tm_mday=13, tm_hour=23, tm_min=30, tm_sec=51, tm_wday=4, tm_yday=44, tm_isdst=0)
False

Details: python built from f65e31fee3 under debug mode

----------
messages: 317111
nosy: eitan.adler
priority: normal
severity: normal
status: open
title: calendar.timegm not always an inverse of time.gmtime

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33579>
_______________________________________


More information about the New-bugs-announce mailing list