From c73eb9bf1954135372b1cc8e7b21d7cc0cdfd489 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 11 Jun 2013 17:55:31 -0700 Subject: gras: reverted chrono changes w/ 32-bit math fix The seconds * ticks per second math was 32 bit, because UL follows the system width, we needed long long. * for loop for heartier unit testing * use get_tps rather than duplicate const number --- include/gras/detail/chrono.hpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'include/gras/detail') diff --git a/include/gras/detail/chrono.hpp b/include/gras/detail/chrono.hpp index 9fe317a..6225e55 100644 --- a/include/gras/detail/chrono.hpp +++ b/include/gras/detail/chrono.hpp @@ -29,7 +29,6 @@ namespace gras #else #include -#include namespace gras { @@ -37,14 +36,8 @@ namespace gras GRAS_FORCE_INLINE time_ticks_t time_now(void) { struct timespec ts; - if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) - return ts.tv_sec*1000000000UL + ts.tv_nsec; - - struct timeval tv; - if (gettimeofday(&tv, NULL) == 0) - return tv.tv_sec*1000000000UL + tv.tv_usec*1000UL; - - return 0; + clock_gettime(CLOCK_MONOTONIC, &ts); + return ts.tv_sec*time_tps() + ts.tv_nsec; } GRAS_FORCE_INLINE time_ticks_t time_tps(void) -- cgit