Skip to content

Commit 86116ae

Browse files
authored
Fix overflow on 32-bit Linux systems (#931)
1 parent d66cb96 commit 86116ae

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

arrow/constants.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@
1515
# but will trigger an OverflowError, ValueError, or OSError on Windows
1616
_MAX_TIMESTAMP = datetime.max.timestamp()
1717
except (OverflowError, ValueError, OSError): # pragma: no cover
18-
# Fallback for Windows if initial max timestamp call fails
18+
# Fallback for Windows and 32-bit systems if initial max timestamp call fails
1919
# Must get max value of ctime on Windows based on architecture (x32 vs x64)
2020
# https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/ctime-ctime32-ctime64-wctime-wctime32-wctime64
21+
# Note: this may occur on both 32-bit Linux systems (issue #930) along with Windows systems
2122
is_64bits = sys.maxsize > 2 ** 32
2223
_MAX_TIMESTAMP = (
23-
datetime(3000, 12, 31, 23, 59, 59, 999999).timestamp()
24+
datetime(3000, 1, 1, 23, 59, 59, 999999).timestamp()
2425
if is_64bits
25-
else datetime(2038, 1, 18, 23, 59, 59, 999999).timestamp()
26+
else datetime(2038, 1, 1, 23, 59, 59, 999999).timestamp()
2627
)
2728

2829
MAX_TIMESTAMP: Final[float] = _MAX_TIMESTAMP

0 commit comments

Comments
 (0)