From 1eedb024a141665fd186d1d51e73bb64c6202476 Mon Sep 17 00:00:00 2001 From: Martin Koegler Date: Sat, 23 Aug 2008 00:54:20 +0200 Subject: [PATCH] Use montonic clock for pthsem Signed-off-by: Martin Koegler --- pth_time.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/pth_time.c b/pth_time.c index b94dafe..e81f80a 100644 --- a/pth_time.c +++ b/pth_time.c @@ -60,6 +60,17 @@ intern void pth_time_usleep(unsigned long usec) #else #define __gettimeofday(t) gettimeofday(t, NULL) #endif +#undef __gettimeofday + +static int inline __gettimeofday(struct timeval *tv) +{ + struct timespec t; + int res = clock_gettime(CLOCK_MONOTONIC, &t); + tv->tv_sec = t.tv_sec; + tv->tv_usec = t.tv_nsec/1000; + return res; +} + #define pth_time_set(t1,t2) \ do { \ if ((t2) == PTH_TIME_NOW) \ -- 1.5.3.1