From 275f04c76cd67635ad8676a70960769376192eb7 Mon Sep 17 00:00:00 2001 From: Silent Date: Sun, 11 Jan 2026 07:33:49 +0100 Subject: [PATCH] Fix Y2038 bug on Windows in unreal_setfilemodtime (PR #332) Int32x32To64 macro internally truncates the arguments to int32, while time_t is 64-bit on most/all modern platforms. Therefore, usage of this macro creates a Year 2038 bug. --- src/support.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/support.c b/src/support.c index 5addaef86..5f09c7b2e 100644 --- a/src/support.c +++ b/src/support.c @@ -1123,7 +1123,7 @@ void unreal_setfilemodtime(const char *filename, time_t mtime) FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) return; - llValue = Int32x32To64(mtime, 10000000) + 116444736000000000; + llValue = (mtime * 10000000LL) + 116444736000000000LL; mTime.dwLowDateTime = (long)llValue; mTime.dwHighDateTime = llValue >> 32;