#define MS_PER_S 1000
#define US_PER_S (US_PER_MS * MS_PER_S)
+#ifdef CLOCK_MONOTONIC_RAW /* Defined in glibc bits/time.h */
+#define CLOCK_TYPE_ID CLOCK_MONOTONIC_RAW
+#else
+#define CLOCK_TYPE_ID CLOCK_MONOTONIC
+#endif
+
struct alarm_entry {
LIST_ENTRY(alarm_entry) next;
struct timeval time;
rte_spinlock_lock(&alarm_list_lk);
while ((ap = LIST_FIRST(&alarm_list)) !=NULL &&
- clock_gettime(CLOCK_MONOTONIC_RAW, &now) == 0 &&
+ clock_gettime(CLOCK_TYPE_ID, &now) == 0 &&
(ap->time.tv_sec < now.tv_sec || (ap->time.tv_sec == now.tv_sec &&
(ap->time.tv_usec * NS_PER_US) <= now.tv_nsec))) {
ap->executing = 1;
return -ENOMEM;
/* use current time to calculate absolute time of alarm */
- clock_gettime(CLOCK_MONOTONIC_RAW, &now);
+ clock_gettime(CLOCK_TYPE_ID, &now);
new_alarm->cb_fn = cb_fn;
new_alarm->cb_arg = cb_arg;