1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-16 03:23:15 +01:00

Win32: Fix a Y2038 bug in TimeToSystemTime (#16681)

This commit is contained in:
Silent
2022-02-18 11:22:29 +01:00
committed by GitHub
parent 2b4579bd93
commit 2ac24e7c3f

View File

@@ -185,11 +185,12 @@ namespace Platform
static SYSTEMTIME TimeToSystemTime(std::time_t timestamp)
{
LONGLONG ll = Int32x32To64(timestamp, 10000000) + 116444736000000000;
ULARGE_INTEGER time_value;
time_value.QuadPart = (timestamp * 10000000LL) + 116444736000000000LL;
FILETIME ft;
ft.dwLowDateTime = static_cast<DWORD>(ll);
ft.dwHighDateTime = ll >> 32;
ft.dwLowDateTime = time_value.LowPart;
ft.dwHighDateTime = time_value.HighPart;
SYSTEMTIME st;
FileTimeToSystemTime(&ft, &st);