diff options
author | Colin Guthrie <cguthrie@mandriva.org> | 2011-02-25 09:24:07 +0000 |
---|---|---|
committer | Colin Guthrie <cguthrie@mandriva.org> | 2011-02-25 09:24:07 +0000 |
commit | a3dbdb044656e2f3ab9c7ae54fe74b9669155f2d (patch) | |
tree | d033464ab41e36f04763235160f1024afa0438b7 /src/pulse/timeval.c | |
parent | f51889c6f64f11221caba3615bf779fc19d0dd15 (diff) | |
parent | 821562b9bc8d1a9033daaae0fd5373498a085054 (diff) |
Merge remote-tracking branch 'mkbosmans/mingw32-build'
Diffstat (limited to 'src/pulse/timeval.c')
-rw-r--r-- | src/pulse/timeval.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/pulse/timeval.c b/src/pulse/timeval.c index cde4417c..10ba322f 100644 --- a/src/pulse/timeval.c +++ b/src/pulse/timeval.c @@ -31,36 +31,28 @@ #include <windows.h> #endif -#include <pulsecore/winsock.h> #include <pulsecore/macro.h> #include <pulsecore/core-util.h> #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; @@ -69,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) { |