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 ...@@ -174,6 +174,8 @@ case "${host_os}" in
# Define on HP-UX to enable all library features # Define on HP-UX to enable all library features
CPPFLAGS="-D_POSIX_C_SOURCE=200112L $CPPFLAGS" CPPFLAGS="-D_POSIX_C_SOURCE=200112L $CPPFLAGS"
AC_DEFINE(ZMQ_HAVE_HPUX, 1, [Have HPUX OS]) AC_DEFINE(ZMQ_HAVE_HPUX, 1, [Have HPUX OS])
LIBZMQ_CHECK_LANG_FLAG_PREPEND([-Ae])
AC_CHECK_FUNCS(gethrtime)
;; ;;
*mingw32*) *mingw32*)
AC_DEFINE(ZMQ_HAVE_WINDOWS, 1, [Have Windows OS]) AC_DEFINE(ZMQ_HAVE_WINDOWS, 1, [Have Windows OS])
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include <sys/time.h> #include <sys/time.h>
#endif #endif
#if defined HAVE_CLOCK_GETTIME #if defined HAVE_CLOCK_GETTIME || defined HAVE_GETHRTIME
#include <time.h> #include <time.h>
#endif #endif
...@@ -65,7 +65,7 @@ uint64_t zmq::clock_t::now_us () ...@@ -65,7 +65,7 @@ uint64_t zmq::clock_t::now_us ()
double ticks_div = (double) (ticksPerSecond.QuadPart / 1000000); double ticks_div = (double) (ticksPerSecond.QuadPart / 1000000);
return (uint64_t) (tick.QuadPart / ticks_div); 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. // Use POSIX clock_gettime function to get precise monotonic time.
struct timespec tv; struct timespec tv;
...@@ -82,6 +82,10 @@ uint64_t zmq::clock_t::now_us () ...@@ -82,6 +82,10 @@ uint64_t zmq::clock_t::now_us ()
} }
return (tv.tv_sec * (uint64_t) 1000000 + tv.tv_nsec / 1000); return (tv.tv_sec * (uint64_t) 1000000 + tv.tv_nsec / 1000);
#elif defined HAVE_GETHRTIME
return (gethrtime () / 1000);
#else #else
// Use POSIX gettimeofday function to get precise time. // 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