summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/tools/qelapsedtimer_win.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/corelib/tools/qelapsedtimer_win.cpp b/src/corelib/tools/qelapsedtimer_win.cpp
index d79dc5d..e6bce27 100644
--- a/src/corelib/tools/qelapsedtimer_win.cpp
+++ b/src/corelib/tools/qelapsedtimer_win.cpp
@@ -42,6 +42,8 @@
#include "qelapsedtimer.h"
#include <windows.h>
+#include <private/qsystemlibrary_p.h>
+
typedef ULONGLONG (WINAPI *PtrGetTickCount64)(void);
static PtrGetTickCount64 ptrGetTickCount64 = 0;
@@ -52,21 +54,17 @@ static quint64 counterFrequency = 0;
static void resolveLibs()
{
- static bool done = false;
+ static volatile bool done = false;
if (done)
return;
// try to get GetTickCount64 from the system
- HMODULE kernel32 = GetModuleHandleW(L"kernel32");
- if (!kernel32)
+ QSystemLibrary kernel32(QLatin1String("kernel32"));
+ if (!kernel32.load())
return;
-#if defined(Q_OS_WINCE)
// does this function exist on WinCE, or will ever exist?
- ptrGetTickCount64 = (PtrGetTickCount64)GetProcAddress(kernel32, L"GetTickCount64");
-#else
- ptrGetTickCount64 = (PtrGetTickCount64)GetProcAddress(kernel32, "GetTickCount64");
-#endif
+ ptrGetTickCount64 = (PtrGetTickCount64)kernel32.resolve("GetTickCount64");
// Retrieve the number of high-resolution performance counter ticks per second
LARGE_INTEGER frequency;