[issue46856] datetime.max conversion

Joris Geysens report at bugs.python.org
Fri Feb 25 16:38:57 EST 2022


Joris Geysens <joris.geysens at enervalis.com> added the comment:

I see this in the python source code being tested (datetimetester.py), so I guess it is a rounding problem : 

# maximum timestamp: set seconds to zero to avoid rounding issues
        max_dt = self.theclass.max.replace(tzinfo=timezone.utc,
                                           second=0, microsecond=0)
        max_ts = max_dt.timestamp()
        # date 9999-12-31 23:59:00+00:00: timestamp 253402300740
        self.assertEqual(self.theclass.fromtimestamp(max_ts, tz=timezone.utc),
                         max_dt)

----------
components: +Library (Lib)

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


More information about the Python-bugs-list mailing list