Starting with glibc 2.34 (bookworm), you can compile with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64. (Or define the corresponding macros in every source file, such as by having your own "config.h" that is included before any system headers.)
This makes time_t a 64bit type, and automatically calls the 64bit-capable versions of all standard library functions (no need to explicitly suffix -64 anywhere). If you use any third-party libraries, they may need to be compiled with the same options.
Newer architectures (such as RISC-V32) use the 64bit types by default, and distributions are likely to break compatibility by enforcing 64bit times and offsets before 2038, unless they drop support for 32bit CPUs first.
Warning: setting the system clock beyond 2038 on a install with 32bit default time_t leads to comical levels of breakage. Nearly everything (including sudo) crashes with "Value too large for defined data type". I had to use SysRq to reboot.
If you move to 64bit userspace then (unlike on Windows) long also becomes 64bit. Other than that your code should work without change, and you avoid all concerns about lack of support in libraries or other system components.
I do not understand the questions about mixing 32 and 64. A 64bit distribution can run 32bit code, but that is rarely useful. Build everything to match the distro you choose.
This makes time_t a 64bit type, and automatically calls the 64bit-capable versions of all standard library functions (no need to explicitly suffix -64 anywhere). If you use any third-party libraries, they may need to be compiled with the same options.
Newer architectures (such as RISC-V32) use the 64bit types by default, and distributions are likely to break compatibility by enforcing 64bit times and offsets before 2038, unless they drop support for 32bit CPUs first.
Warning: setting the system clock beyond 2038 on a install with 32bit default time_t leads to comical levels of breakage. Nearly everything (including sudo) crashes with "Value too large for defined data type". I had to use SysRq to reboot.
If you move to 64bit userspace then (unlike on Windows) long also becomes 64bit. Other than that your code should work without change, and you avoid all concerns about lack of support in libraries or other system components.
I do not understand the questions about mixing 32 and 64. A 64bit distribution can run 32bit code, but that is rarely useful. Build everything to match the distro you choose.
Statistics: Posted by jojopi — Thu Feb 08, 2024 12:44 pm