Files
MINGW-packages/mingw-w64-qtwebkit/0001-gettickcount64-compatibility-xp.patch
2017-06-11 09:24:24 +03:00

39 lines
1.2 KiB
Diff

--- qtwebkit-tp5/Source/WTF/wtf/CurrentTime.cpp.orig 2017-02-07 20:18:29.395887200 +0300
+++ qtwebkit-tp5/Source/WTF/wtf/CurrentTime.cpp 2017-02-07 20:20:03.241254800 +0300
@@ -91,6 +91,35 @@
#if USE(QUERY_PERFORMANCE_COUNTER)
+#if defined(_WIN32) && (defined(__x86_64__) || defined(_AMD64_)) && _WIN32_WINNT < 0x0600
+/* GetTickCount64() is not available on XP. */
+ULONGLONG GetTickCount64 ()
+{
+ static ULONGLONG (CALLBACK *DynGetTickCount64)() = (ULONGLONG (*)(void))-1;
+ static DWORD last_ticks = 0;
+ static DWORD n_overflow = 0;
+ DWORD ticks = 0;
+ HINSTANCE hKernel32;
+
+ if (DynGetTickCount64 == (void*)-1)
+ {
+ hKernel32 = GetModuleHandleW(L"KERNEL32");
+ DynGetTickCount64 = *(ULONGLONG (*)(void))(GetProcAddress(hKernel32,
+ "GetTickCount64"));
+ }
+ if (DynGetTickCount64 != (void*) NULL)
+ {
+ return DynGetTickCount64();
+ }
+
+ ticks = GetTickCount();
+ if (ticks < last_ticks)
+ n_overflow++;
+ last_ticks = ticks;
+ return ((ULONGLONG)n_overflow << 32LL) + (ULONGLONG)GetTickCount();
+}
+#endif
+
static LARGE_INTEGER qpcFrequency;
static bool syncedTime;