diff options
author | Chris Wilson <chris+github@qwirx.com> | 2015-01-02 19:18:12 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2015-01-02 19:18:12 +0000 |
commit | d9f7714287aba5cc5138df0593b0495a81f96d98 (patch) | |
tree | 19e82dcc2fd173e63e792c2e7da746eddab1403d /lib/win32/emu.cpp | |
parent | fc30df15a51d3937f48b2dd0380f09c361ff6e8e (diff) |
Fix random timezone errors on restore.
Work in UTC inside Box Backup, not local time.
Diffstat (limited to 'lib/win32/emu.cpp')
-rw-r--r-- | lib/win32/emu.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/win32/emu.cpp b/lib/win32/emu.cpp index f9c06714..fb8fb437 100644 --- a/lib/win32/emu.cpp +++ b/lib/win32/emu.cpp @@ -1863,7 +1863,7 @@ int writev(int filedes, const struct iovec *vector, size_t count) return bytes; } -// need this for conversions +// Need this for conversions. Works in UTC. time_t ConvertFileTimeToTime_t(FILETIME *fileTime) { SYSTEMTIME stUTC; @@ -1882,18 +1882,17 @@ time_t ConvertFileTimeToTime_t(FILETIME *fileTime) // timeinfo.tm_yday = ...; timeinfo.tm_year = stUTC.wYear - 1900; - time_t retVal = mktime(&timeinfo) - _timezone; + time_t retVal = _mkgmtime(&timeinfo); return retVal; } bool ConvertTime_tToFileTime(const time_t from, FILETIME *pTo) { - time_t adjusted = from + _timezone; - struct tm *time_breakdown = gmtime(&adjusted); + struct tm *time_breakdown = gmtime(&from); if (time_breakdown == NULL) { ::syslog(LOG_ERR, "Error: failed to convert time format: " - "%d is not a valid time\n", adjusted); + "%d is not a valid time\n", from); return false; } |