rom-properties/cmake/macros/64BitTimeSupport.c
David Korth 187b68b502 [cmake] Check64BitTimeSupport.cmake: Check for 64-bit time_t.
Supported by MSVC 2005, MinGW-w64, 64-bit glibc, and 64-bit Mac OS X.

glibc is working on adding 64-bit time_t for 32-bit software.
Support for that has been added using -D_TIME_BITS=64.

32-bit Mac OS X doesn't, and won't, support 64-bit time_t.

References:
- https://lwn.net/Articles/715242/
- https://sourceware.org/glibc/wiki/Y2038ProofnessDesign
2017-02-25 18:02:57 -05:00

18 lines
461 B
C

/**
* 64-bit time_t test code.
* Reference: https://github.com/Benjamin-Dobell/Heimdall/blob/master/cmake/LargeFiles.c
*/
#include <stdint.h>
#include <time.h>
/** static_assert() macro copied from c++11-compat.h **/
#define static_assert(expr, msg) switch (0) { case 0: case (expr): ; }
int main(int argc, char *argv[])
{
static_assert(sizeof(time_t) == sizeof(int64_t), "time_t is the wrong size");
int64_t tm64;
time_t tm = time(&tm64);
return 0;
}