X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;ds=sidebyside;f=src%2Ftimer.c;h=55f5f9cf2905e82492dbbbdaf9e17d6a9fd5d4bf;hb=77d660e915420444be90d37c6530797122d0c156;hp=8889109b7fcd5cedf9bd5e95b0165768643ef9ca;hpb=46d18f60766f997d0ca37c5937f58c0c06477932;p=umurmur.git diff --git a/src/timer.c b/src/timer.c index 8889109..55f5f9c 100644 --- a/src/timer.c +++ b/src/timer.c @@ -1,5 +1,5 @@ -/* Copyright (C) 2009-2010, Martin Johansson - Copyright (C) 2005-2010, Thorvald Natvig +/* Copyright (C) 2009-2013, Martin Johansson + Copyright (C) 2005-2013, Thorvald Natvig All rights reserved. @@ -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; }