Files
CMake/Tests/RunCMake/string/Timestamp2038.cmake
Brad King 74519e1c83 string(TIMESTAMP): Fix %s placeholder for year 2038 on Windows
`difftime` returns a `double`, so commit 6727270b75 (CMake: Extend
TIMESTAMP sub-commands with new unix time format specifier, 2016-02-16,
v3.6.0-rc1~338^2) cast it to `long` to get an integer result.  However,
in the MSVC ABI, `long` is a 32-bit integer.  Use an explicit 64-bit
integer type instead.

Fixes: #26716
2025-02-26 08:14:56 -05:00

4 lines
194 B
CMake

set(ENV{SOURCE_DATE_EPOCH} "2147576400")
string(TIMESTAMP RESULT "%Y-%m-%d %H:%M:%S.%f %A=%a %B=%b %y day=%j wd=%w week=%U w_iso=%V %%I=%I epoch=%s TZ=%Z tz=%z" UTC)
message("RESULT=${RESULT}")