Merge pull request #2814 from CookiePLMonster/y2038

Fix a Y2038 bug in UnixTimeToFileTime
This commit is contained in:
Connor McLaughlin 2022-03-27 17:47:35 +10:00 committed by GitHub
commit 07d331deca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -281,13 +281,13 @@ Timestamp& Timestamp::operator=(const Timestamp& other)
#if defined(_WIN32)
// http://support.microsoft.com/kb/167296
// https://docs.microsoft.com/en-us/windows/win32/sysinfo/converting-a-time-t-value-to-a-file-time
static void UnixTimeToFileTime(time_t t, LPFILETIME pft)
{
LONGLONG ll;
ll = Int32x32To64(t, 10000000ULL) + 116444736000000000ULL;
pft->dwLowDateTime = (DWORD)ll;
pft->dwHighDateTime = ll >> 32;
ULARGE_INTEGER time_value;
time_value.QuadPart = (t * 10000000LL) + 116444736000000000LL;
pft->dwLowDateTime = time_value.LowPart;
pft->dwHighDateTime = time_value.HighPart;
}
static void UnixTimeToSystemTime(time_t t, LPSYSTEMTIME pst)
{