[issue29097] datetime.fromtimestamp(t) when 0 <= t <= 86399 fails on Python 3.6

Ammar Askar report at bugs.python.org
Thu Dec 29 12:00:53 EST 2016


Ammar Askar added the comment:

I just ran the following script to check if there are any folds from timestamps [0, 86399] in any timezone.

  import datetime
  import pytz

  for tz in pytz.all_timezones:
      tz = pytz.timezone(tz)
      for i in range(86400):
          if datetime.datetime.fromtimestamp(i, tz).fold == 1:
              print(str(tz)) 

and it turns out there aren't any. I highly doubt any timezone is going to retroactively enable/disable DST during the epoch, so a potentially hacky fix is to just have a windows specific check for this value range.

I'm adding the people involved in PEP 495 to the nosy list so they can give their input.

----------
nosy: +tim.peters

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


More information about the Python-bugs-list mailing list