This is the patch Mikko attached to issue 301, adjusted to patch against current libzmq. I'm willing to submit this as a pull request on github as well, but I wasn't sure where things were with that - already sent the pull request for zeromq2-1.
Thanks, -- AJ Lewis Software Engineer Quantum Corporation Work: 651 688-4346 ---------------------------------------------------------------------- The information contained in this transmission may be confidential. Any disclosure, copying, or further distribution of confidential information is not permitted unless such privilege is explicitly granted in writing by Quantum. Quantum reserves the right to have electronic communications, including email and attachments, sent across its networks filtered through anti virus and spam software programs and retain such messages in order to comply with applicable data security and retention requirements. Quantum is not responsible for the proper and complete transmission of the substance of this communication or for any delay in its receipt.
>From 2e0c4330fa3d1044ca3d89a0f1798a88b7cc3215 Mon Sep 17 00:00:00 2001 From: AJ Lewis <[email protected]> Date: Thu, 19 Jan 2012 12:27:19 -0600 Subject: [PATCH] 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 <[email protected]> --- configure.in | 2 ++ src/clock.cpp | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/configure.in b/configure.in index 0c8cc2f..9cea99a 100644 --- a/configure.in +++ b/configure.in @@ -174,6 +174,8 @@ case "${host_os}" in # Define on HP-UX to enable all library features CPPFLAGS="-D_POSIX_C_SOURCE=200112L $CPPFLAGS" AC_DEFINE(ZMQ_HAVE_HPUX, 1, [Have HPUX OS]) + LIBZMQ_CHECK_LANG_FLAG_PREPEND([-Ae]) + AC_CHECK_FUNCS(gethrtime) ;; *mingw32*) AC_DEFINE(ZMQ_HAVE_WINDOWS, 1, [Have Windows OS]) diff --git a/src/clock.cpp b/src/clock.cpp index 4868a5f..2a9ca14 100644 --- a/src/clock.cpp +++ b/src/clock.cpp @@ -34,7 +34,7 @@ #include <sys/time.h> #endif -#if defined HAVE_CLOCK_GETTIME +#if defined HAVE_CLOCK_GETTIME || defined HAVE_GETHRTIME #include <time.h> #endif @@ -65,7 +65,7 @@ uint64_t zmq::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 zmq::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. -- 1.7.7
_______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
