@@ -712,14 +712,8 @@ static inline int64_t get_clock_realtime(void)
also used by simpletrace backend and tracepoints would cause
an infinite recursion! */
#ifdef _WIN32
-extern int64_t clock_freq;
-static inline int64_t get_clock(void)
-{
- LARGE_INTEGER ti;
- QueryPerformanceCounter(&ti);
- return muldiv64(ti.QuadPart, get_ticks_per_sec(), clock_freq);
-}
+int64_t get_clock(void);
#else
@@ -28,7 +28,16 @@
#ifdef _WIN32
-int64_t clock_freq;
+#include "sysemu/os-winapi.h" /* QueryPerformanceCounter, ... */
+
+static int64_t clock_freq;
+
+int64_t get_clock(void)
+{
+ LARGE_INTEGER ti;
+ QueryPerformanceCounter(&ti);
+ return muldiv64(ti.QuadPart, get_ticks_per_sec(), clock_freq);
+}
static void __attribute__((constructor)) init_get_clock(void)
{
A lot of files depend on qemu/timer.h. We don't want that all these files depend on windows.h, too. Signed-off-by: Stefan Weil <sw@weilnetz.de> --- include/qemu/timer.h | 8 +------- util/qemu-timer-common.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 8 deletions(-)