diff --git a/platforms/win32/vm/sqWin32Heartbeat.c b/platforms/win32/vm/sqWin32Heartbeat.c index 28b9d61527..b6c4a0f709 100755 --- a/platforms/win32/vm/sqWin32Heartbeat.c +++ b/platforms/win32/vm/sqWin32Heartbeat.c @@ -260,6 +260,17 @@ ioInitTime(void) utcStartMicroseconds = utcMicrosecondClock; } +void resyncSystemTime() { + #if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) + // Nothing to be done, time will be resynced upon every heartbeat tick + #else // (_WIN32_WINNT >= _WIN32_WINNT_WIN8) + // By setting these values to maximum, currentUTCMicroseconds() will resync to the system time. + lastTick = (DWORD)-1; + vmThreadLastTick = (DWORD)-1; + #endif + ioUpdateVMTimezone(); +} + unsigned long long ioUTCMicroseconds() { return get64(utcMicrosecondClock); } diff --git a/platforms/win32/vm/sqWin32Window.c b/platforms/win32/vm/sqWin32Window.c index 855ae4c532..1cb36fb751 100644 --- a/platforms/win32/vm/sqWin32Window.c +++ b/platforms/win32/vm/sqWin32Window.c @@ -625,6 +625,11 @@ MainWndProcW(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) case WM_KILLFOCUS: fHasFocus = 0; return DefWindowProcW(hwnd,message,wParam,lParam); + + case WM_TIMECHANGE: + resyncSystemTime(); + return DefWindowProcW(hwnd,message,wParam,lParam); + default: /* Unprocessed messages may be processed outside the current module. If firstMessageHook is non-NULL and returns a non