From: Martin Johansson Date: Sun, 10 Nov 2013 18:37:06 +0000 (-0800) Subject: Merge pull request #23 from Rawi666/ipv4 X-Git-Url: http://git.code-monkey.de/?a=commitdiff_plain;h=6d80ba13a502a0d60dcd6b47a32c244ce2b253b8;hp=0203f5ed9211a3e0958d83844db32bad7a0e11e7;p=umurmur.git Merge pull request #23 from Rawi666/ipv4 Changed to monotonic clock for timespan measurements --- diff --git a/src/timer.c b/src/timer.c index 5383e0e..55f5f9c 100644 --- a/src/timer.c +++ b/src/timer.c @@ -36,12 +36,12 @@ static uint64_t Timer_now() { - struct timeval tv; + struct timespec ts; uint64_t e; - gettimeofday(&tv, NULL); - e = tv.tv_sec * 1000000LL; - e += tv.tv_usec; + clock_gettime(CLOCK_MONOTONIC, &ts); + e = ts.tv_sec * 1000000LL; + e += ts.tv_nsec / 1000LL; //convert to microseconds return e; }