summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Antonuk <alan.antonuk@gmail.com>2014-05-07 20:57:14 -0700
committerAlan Antonuk <alan.antonuk@gmail.com>2014-05-07 20:57:14 -0700
commit3e83192454fbcaa4e6ef18c8fc3c76f15494877a (patch)
tree409357bfa57e9724ce2e393b32ecf207d81ef32a
parent932de5ff045353ed7ca83810fe088a0f58cf1d33 (diff)
downloadrabbitmq-c-github-ask-3e83192454fbcaa4e6ef18c8fc3c76f15494877a.tar.gz
Use gethrtime() on HP-UX for timers.
HP-UX does not have clock_gettime(CLOCK_MONOTONIC), instead use platform-specific gethrtime() function. Thanks to zhongk for this fix.
-rw-r--r--librabbitmq/amqp_timer.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/librabbitmq/amqp_timer.c b/librabbitmq/amqp_timer.c
index 95606b8..2b41c83 100644
--- a/librabbitmq/amqp_timer.c
+++ b/librabbitmq/amqp_timer.c
@@ -90,12 +90,16 @@ amqp_get_monotonic_timestamp(void)
uint64_t
amqp_get_monotonic_timestamp(void)
{
+#ifdef __hpux
+ return (uint64_t)gethrtime();
+#else
struct timespec tp;
if (-1 == clock_gettime(CLOCK_MONOTONIC, &tp)) {
return 0;
}
return ((uint64_t)tp.tv_sec * AMQP_NS_PER_S + (uint64_t)tp.tv_nsec);
+#endif
}
#endif /* AMQP_POSIX_TIMER_API */