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 <s...@weilnetz.de> --- include/qemu/timer.h | 8 +------- util/qemu-timer-common.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/include/qemu/timer.h b/include/qemu/timer.h index 7f9a074..19316b7 100644 --- a/include/qemu/timer.h +++ b/include/qemu/timer.h @@ -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 diff --git a/util/qemu-timer-common.c b/util/qemu-timer-common.c index 95e0847..22b0109 100644 --- a/util/qemu-timer-common.c +++ b/util/qemu-timer-common.c @@ -28,7 +28,16 @@ #ifdef _WIN32 -int64_t clock_freq; +#include "qemu/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) { -- 1.7.10.4