From 4f1d4044f8409ff29eeb7f97324daba496e40714 Mon Sep 17 00:00:00 2001 From: Maarten Bosmans Date: Tue, 4 Jan 2011 17:03:13 +0100 Subject: Use instead of The check whether POSIX socket.h or WIN32 winsock2.h must be included can be made centrally. The downside is that some functionality of e.g. arpa/inet.h is also implemented in winsock.h, so that some files that don't use socket functions, but do use inet.h functions, must also include pulsecore/socket.h. (as well as arpa/inet.h) --- src/pulse/timeval.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/pulse/timeval.c') diff --git a/src/pulse/timeval.c b/src/pulse/timeval.c index cde4417c..c4a08419 100644 --- a/src/pulse/timeval.c +++ b/src/pulse/timeval.c @@ -31,7 +31,6 @@ #include #endif -#include #include #include -- cgit 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/timeval.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'src/pulse/timeval.c') 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