Merge pull request #2814 from CookiePLMonster/y2038
Fix a Y2038 bug in UnixTimeToFileTime
This commit is contained in:
commit
07d331deca
|
@ -281,13 +281,13 @@ Timestamp& Timestamp::operator=(const Timestamp& other)
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#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)
|
static void UnixTimeToFileTime(time_t t, LPFILETIME pft)
|
||||||
{
|
{
|
||||||
LONGLONG ll;
|
ULARGE_INTEGER time_value;
|
||||||
ll = Int32x32To64(t, 10000000ULL) + 116444736000000000ULL;
|
time_value.QuadPart = (t * 10000000LL) + 116444736000000000LL;
|
||||||
pft->dwLowDateTime = (DWORD)ll;
|
pft->dwLowDateTime = time_value.LowPart;
|
||||||
pft->dwHighDateTime = ll >> 32;
|
pft->dwHighDateTime = time_value.HighPart;
|
||||||
}
|
}
|
||||||
static void UnixTimeToSystemTime(time_t t, LPSYSTEMTIME pst)
|
static void UnixTimeToSystemTime(time_t t, LPSYSTEMTIME pst)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue