Hello Kitware Team,
The Year 2038 problem threatens 32-bit systems using a 32-bit time_t, which overflows in January 2038.
Autoconf 2.72 addresses this problem with its AC_SYS_YEAR2038_RECOMMENDED macro, introduced in 2023 [1].
This macro automatically checks for 64-bit time_t support, enables it via _TIME_BITS=64 on compatible systems
(e.g., glibc 2.34+ [2]), and enforces compliance, ensuring many software remains future-proof.
Could CMake offered a CMAKE_YEAR2038_RECOMMENDED option or module?
e.g.:
$ cmake -DCMAME_YEAR2038_RECOMMENDED=ON
Behavior could be like:
-
Checks if sizeof(time_t) >= 8 natively.
-
If not, tests _TIME_BITS=64 with a small program.
-
Defines necessary macros (e.g. “#define _TIME_BITS 64”, “#define _FILE_OFFSET_BITS 64”) in config.h if the
result is successful. -
Errors out with a message if unsupported.
What do you think about it?
[1] autoconf-2.72 released [stable]
[2] The GNU C Library version 2.34 is now available
Salutations,