robotframework: DateTime suffers from "Year 2038" problem with epoch conversion on 32 bit systems
Problem
The datetime library is not able to convert timestamp in far future (Dec 31 14:10:36 2040 GMT) to epoch timestamp (integer) on 32 bit systems (like raspberry pi).
Example:
Convert Date Dec 31 14:10:36 2040 GMT date_format=%b %d %H:%M:%S %Y %Z result_format=epoch
Raises
OverflowError: mktime argument out of range
This is caused by https://github.com/robotframework/robotframework/blob/208b8988254af37867d487682604f6e1229a3cf0/src/robot/libraries/DateTime.py#L576
not handling timestamp over 32 bit integers well.
environment
- 32 bit raspberry pi 3
- python 3.7.3
- 3.2.1
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 1
- Comments: 26 (19 by maintainers)
Commits related to this issue
- Fixes: - Fix y2038 problem (#4244) for 32 bit systems - Fix dt.convert(format="epoch") to output epoch in GMT not in local time — committed to juha-ylikoski/robotframework by juha-ylikoski 2 years ago
- Try to fix new test that fails on CI due to DST. To some extend related to #4244. — committed to robotframework/robotframework by pekkaklarck 6 months ago
- DateTime: Workaround for Y2038 bug in conversion from epoch seconds. Related to issue #4244. Also remove `raise OverflowError` left accidentallly in related commmit 3e12655cb986534c964710dc8e6a93aa1... — committed to robotframework/robotframework by pekkaklarck 6 months ago
- DateTime: Remove Y2038 workarounds that don't seem to work properly. See #4244 for more information. — committed to robotframework/robotframework by pekkaklarck 6 months ago
- DateTime: Workaround for Y2038 bug in conversion to epoch seconds. Hopefully this resolves #4244. — committed to otemek/robotframework by pekkaklarck 6 months ago
I can.
I guess you are referring to commit id ebbcd9580d1a1a34a048e6dbb2fdd14e274b23e9 (the link was broken).
I have installed the version by creating a new python virtual env and installing the robotframework with:
And run a test case with:
And got:
I tried to convert a datetime to integer with year>2040:
I think this is relevant bug in python datetime library: https://github.com/python/cpython/issues/101069
Version info:
Was run with raspberry pi 3B
Already tested that DST causes problems. This is a better workaround: