From a39a83665f07a0819a31ee2d1ab60210a67c47a2 Mon Sep 17 00:00:00 2001 From: Maarten Bosmans Date: Tue, 18 Jan 2011 11:26:57 +0100 Subject: win32: Implement rtclock based on QueryPerformanceCounter Also remove some unnecessary headers. --- src/pulse/def.h | 1 - src/pulse/mainloop-api.h | 1 - src/pulse/rtclock.c | 2 +- src/pulse/timeval.c | 15 +++++---------- 4 files changed, 6 insertions(+), 13 deletions(-) (limited to 'src/pulse') diff --git a/src/pulse/def.h b/src/pulse/def.h index 4a8da137..ac4ae538 100644 --- a/src/pulse/def.h +++ b/src/pulse/def.h @@ -25,7 +25,6 @@ #include #include -#include #include #include diff --git a/src/pulse/mainloop-api.h b/src/pulse/mainloop-api.h index aa0d5e73..0ce2219b 100644 --- a/src/pulse/mainloop-api.h +++ b/src/pulse/mainloop-api.h @@ -24,7 +24,6 @@ ***/ #include -#include #include #include diff --git a/src/pulse/rtclock.c b/src/pulse/rtclock.c index 49ff6aae..baa0f3a5 100644 --- a/src/pulse/rtclock.c +++ b/src/pulse/rtclock.c @@ -23,10 +23,10 @@ #include #endif +#include #include #include "rtclock.h" -#include "timeval.h" pa_usec_t pa_rtclock_now(void) { struct timeval tv; diff --git a/src/pulse/timeval.c b/src/pulse/timeval.c index c4a08419..10ba322f 100644 --- a/src/pulse/timeval.c +++ b/src/pulse/timeval.c @@ -37,29 +37,22 @@ #include "timeval.h" struct timeval *pa_gettimeofday(struct timeval *tv) { -#ifdef HAVE_GETTIMEOFDAY pa_assert(tv); - pa_assert_se(gettimeofday(tv, NULL) == 0); - return tv; -#elif defined(OS_IS_WIN32) +#if defined(OS_IS_WIN32) /* * Copied from implementation by Steven Edwards (LGPL). * Found on wine mailing list. */ - #if defined(_MSC_VER) || defined(__BORLANDC__) #define EPOCHFILETIME (116444736000000000i64) #else #define EPOCHFILETIME (116444736000000000LL) #endif - FILETIME ft; LARGE_INTEGER li; int64_t t; - pa_assert(tv); - GetSystemTimeAsFileTime(&ft); li.LowPart = ft.dwLowDateTime; li.HighPart = ft.dwHighDateTime; @@ -68,11 +61,13 @@ struct timeval *pa_gettimeofday(struct timeval *tv) { t /= 10; /* In microseconds */ tv->tv_sec = (time_t) (t / PA_USEC_PER_SEC); tv->tv_usec = (suseconds_t) (t % PA_USEC_PER_SEC); - - return tv; +#elif defined(HAVE_GETTIMEOFDAY) + pa_assert_se(gettimeofday(tv, NULL) == 0); #else #error "Platform lacks gettimeofday() or equivalent function." #endif + + return tv; } pa_usec_t pa_timeval_diff(const struct timeval *a, const struct timeval *b) { -- cgit