]> granicus.if.org Git - libevent/commitdiff
Do not track use_monotonic field when is no monotonic clock
authorNick Mathewson <nickm@torproject.org>
Mon, 9 Apr 2012 17:41:45 +0000 (13:41 -0400)
committerNick Mathewson <nickm@torproject.org>
Mon, 9 Apr 2012 22:29:30 +0000 (18:29 -0400)
event.c

diff --git a/event.c b/event.c
index a85d1f5acf33dda59a749723b70303ec04b4b907..2fc1c22eea7be209b8c47980cd767f2c1e584ab0 100644 (file)
--- a/event.c
+++ b/event.c
@@ -126,7 +126,9 @@ struct event_base *event_global_current_base_ = NULL;
 
 /* Global state */
 
+#ifdef HAVE_ANY_MONOTONIC
 static int use_monotonic;
+#endif
 
 static void *event_self_cbarg_ptr_ = NULL;
 
@@ -398,6 +400,7 @@ gettime(struct event_base *base, struct timeval *tp)
                return (0);
        }
 
+#ifdef HAVE_ANY_MONOTONIC
        if (use_monotonic) {
 #if defined(EVENT__HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
                struct timespec ts;
@@ -426,6 +429,7 @@ gettime(struct event_base *base, struct timeval *tp)
 
                return (0);
        }
+#endif
 
        return (evutil_gettimeofday(tp, NULL));
 }
@@ -2609,8 +2613,10 @@ timeout_correct(struct event_base *base, struct timeval *tv)
        struct timeval off;
        int i;
 
+#ifdef HAVE_ANY_MONOTONIC
        if (use_monotonic)
                return;
+#endif
 
        /* Check if time is running backwards */
        gettime(base, tv);