Commit 95f6a074 authored by Pieter Hintjens's avatar Pieter Hintjens

Merge pull request #224 from vortechs2000/master

Patch from Mikko Koppanen for #LIBZMQ-301
parents 57f64c50 2e0c4330
......@@ -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])
......
......@@ -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;
......@@ -82,6 +82,10 @@ uint64_t zmq::clock_t::now_us ()
}
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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment