summaryrefslogtreecommitdiffstats
path: root/src/pulse
diff options
context:
space:
mode:
authorMaarten Bosmans <mkbosmans@gmail.com>2011-01-18 11:26:57 +0100
committerMaarten Bosmans <mkbosmans@gmail.com>2011-02-17 12:02:31 +0100
commita39a83665f07a0819a31ee2d1ab60210a67c47a2 (patch)
tree7d60d7abbf98f359f541634557245a8ef642f2dd /src/pulse
parent5699954d3360716ad693e0b88596e372afe74443 (diff)
win32: Implement rtclock based on QueryPerformanceCounter
Also remove some unnecessary <time.h> headers.
Diffstat (limited to 'src/pulse')
-rw-r--r--src/pulse/def.h1
-rw-r--r--src/pulse/mainloop-api.h1
-rw-r--r--src/pulse/rtclock.c2
-rw-r--r--src/pulse/timeval.c15
4 files changed, 6 insertions, 13 deletions
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 <inttypes.h>
#include <sys/time.h>
-#include <time.h>
#include <pulse/cdecl.h>
#include <pulse/sample.h>
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 <sys/time.h>
-#include <time.h>
#include <pulse/cdecl.h>
#include <pulse/sample.h>
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 <config.h>
#endif
+#include <pulse/timeval.h>
#include <pulsecore/core-rtclock.h>
#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) {