diff options
author | Brian Aker <brian@tangent.org> | 2012-10-06 19:35:12 -0400 |
---|---|---|
committer | Brian Aker <brian@tangent.org> | 2012-10-06 19:35:12 -0400 |
commit | 8e04e2a97ba16fce9ebf7d47a944de2dc40ba453 (patch) | |
tree | 41def0da3271261d2a8ca374073439c8c368982d /libtest/timer.hpp | |
parent | 5cac64189701682ebc7c89f4daaddc426fc5073e (diff) | |
download | libmemcached-8e04e2a97ba16fce9ebf7d47a944de2dc40ba453.tar.gz |
Remove another chunck of Pandora.
Diffstat (limited to 'libtest/timer.hpp')
-rw-r--r-- | libtest/timer.hpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/libtest/timer.hpp b/libtest/timer.hpp index 28ec4741..eac51940 100644 --- a/libtest/timer.hpp +++ b/libtest/timer.hpp @@ -44,6 +44,7 @@ # include <mach/clock.h> # include <mach/mach.h> #else +# include <time.h> # include <sys/time.h> #endif @@ -122,8 +123,24 @@ private: mach_port_deallocate(mach_task_self(), _clock_serv); ts.tv_sec= _mach_timespec.tv_sec; ts.tv_nsec= _mach_timespec.tv_nsec; +#elif defined(HAVE_CLOCK_GETTIME) && HAVE_CLOCK_GETTIME + int ret; + do + { + ret= clock_gettime(CLOCK_REALTIME, &ts); + } while (ret == -1); +#elif defined(HAVE_GETTIMEOFDAY) && HAVE_GETTIMEOFDAY + struct timeval tv; + int ret; + do + { + ret= gettimeofday(&tv, NULL) + } while (ret == -1); + /* Convert from timeval to timespec */ + ts.tv_sec= tv.tv_sec; + ts.tv_nsec= tv.tv_usec * 1000; #else - clock_gettime(CLOCK_REALTIME, &ts); + memset(&ts, 0, sizeof(struct timespec)); #endif } |