From ada1db899a7a611ee074dc0c3ee9f293131b06ee Mon Sep 17 00:00:00 2001 From: AJ Lewis Date: Thu, 16 Feb 2012 10:02:15 +0900 Subject: Patch from Mikko Koppanen for #LIBZMQ-301 Add the '-Ae' flag and check for gethrtime() on HPUX Check if CLOCK_MONOTONIC defined before using it - if not, use gethrtime() if it's available, otherwise fall back to the old behavior. Signed-off-by: AJ Lewis --- src/clock.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/clock.cpp b/src/clock.cpp index 0406c0a..fe85220 100644 --- a/src/clock.cpp +++ b/src/clock.cpp @@ -1,6 +1,6 @@ /* Copyright (c) 2010-2012 250bpm s.r.o. - Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file + Copyright (c) 2010-2012 Other contributors as noted in the AUTHORS file This file is part of Crossroads project. @@ -34,7 +34,7 @@ #include #endif -#if defined HAVE_CLOCK_GETTIME +#if defined HAVE_CLOCK_GETTIME || defined HAVE_GETHRTIME #include #endif @@ -65,7 +65,7 @@ uint64_t xs::clock_t::now_us () double ticks_div = (double) (ticksPerSecond.QuadPart / 1000000); return (uint64_t) (tick.QuadPart / ticks_div); -#elif defined HAVE_CLOCK_GETTIME +#elif defined HAVE_CLOCK_GETTIME && defined CLOCK_MONOTONIC // Use POSIX clock_gettime function to get precise monotonic time. struct timespec tv; @@ -73,6 +73,10 @@ uint64_t xs::clock_t::now_us () errno_assert (rc == 0); return (tv.tv_sec * (uint64_t) 1000000 + tv.tv_nsec / 1000); +#elif defined HAVE_GETHRTIME + + return (gethrtime () / 1000); + #else // Use POSIX gettimeofday function to get precise time. -- cgit v1.2.3