OLD | NEW |
1 diff --git a/third_party/libevent/evdns.c b/third_party/libevent/evdns.c | 1 diff --git a/third_party/libevent/evdns.c b/third_party/libevent/evdns.c |
2 index f07ecc9..da6ea19 100644 | 2 index f07ecc9..da6ea19 100644 |
3 --- a/third_party/libevent/evdns.c | 3 --- a/third_party/libevent/evdns.c |
4 +++ b/third_party/libevent/evdns.c | 4 +++ b/third_party/libevent/evdns.c |
5 @@ -134,7 +134,7 @@ | 5 @@ -134,7 +134,7 @@ |
6 typedef ev_uint8_t u_char; | 6 typedef ev_uint8_t u_char; |
7 typedef unsigned int uint; | 7 typedef unsigned int uint; |
8 #endif | 8 #endif |
9 -#include <event.h> | 9 -#include <event.h> |
10 +#include "event.h" | 10 +#include "event.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 +++ b/third_party/libevent/evutil.h | 74 +++ b/third_party/libevent/evutil.h |
75 @@ -38,7 +38,7 @@ | 75 @@ -38,7 +38,7 @@ |
76 extern "C" { | 76 extern "C" { |
77 #endif | 77 #endif |
78 | 78 |
79 -#include <event-config.h> | 79 -#include <event-config.h> |
80 +#include "event-config.h" | 80 +#include "event-config.h" |
81 #ifdef _EVENT_HAVE_SYS_TIME_H | 81 #ifdef _EVENT_HAVE_SYS_TIME_H |
82 #include <sys/time.h> | 82 #include <sys/time.h> |
83 #endif | 83 #endif |
| 84 diff --git a/third_party/libevent/event.c b/third_party/libevent/event.c |
| 85 index 1253352..598a98f 100644 |
| 86 --- a/third_party/libevent/event.c |
| 87 +++ b/third_party/libevent/event.c |
| 88 @@ -107,7 +107,7 @@ static const struct eventop *eventops[] = { |
| 89 /* Global state */ |
| 90 struct event_base *current_base = NULL; |
| 91 extern struct event_base *evsignal_base; |
| 92 -static int use_monotonic; |
| 93 +static int no_monotonic_clock = 0; |
| 94 |
| 95 /* Prototypes */ |
| 96 static void event_queue_insert(struct event_base *, struct event *, int); |
| 97 @@ -120,17 +120,6 @@ static int timeout_next(struct event_base *, struct timeval
**); |
| 98 static void timeout_process(struct event_base *); |
| 99 static void timeout_correct(struct event_base *, struct timeval *); |
| 100 |
| 101 -static void |
| 102 -detect_monotonic(void) |
| 103 -{ |
| 104 -#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC) |
| 105 - struct timespec ts; |
| 106 - |
| 107 - if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) |
| 108 - use_monotonic = 1; |
| 109 -#endif |
| 110 -} |
| 111 - |
| 112 static int |
| 113 gettime(struct event_base *base, struct timeval *tp) |
| 114 { |
| 115 @@ -140,18 +129,18 @@ gettime(struct event_base *base, struct timeval *tp) |
| 116 } |
| 117 |
| 118 #if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC) |
| 119 - if (use_monotonic) { |
| 120 - struct timespec ts; |
| 121 - |
| 122 - if (clock_gettime(CLOCK_MONOTONIC, &ts) == -1) |
| 123 - return (-1); |
| 124 + struct timespec ts; |
| 125 |
| 126 + if (no_monotonic_clock == 0 && |
| 127 + clock_gettime(CLOCK_MONOTONIC, &ts) == 0) { |
| 128 tp->tv_sec = ts.tv_sec; |
| 129 tp->tv_usec = ts.tv_nsec / 1000; |
| 130 return (0); |
| 131 } |
| 132 #endif |
| 133 |
| 134 + no_monotonic_clock = 1; |
| 135 + |
| 136 return (evutil_gettimeofday(tp, NULL)); |
| 137 } |
| 138 |
| 139 @@ -175,7 +164,6 @@ event_base_new(void) |
| 140 if ((base = calloc(1, sizeof(struct event_base))) == NULL) |
| 141 event_err(1, "%s: calloc", __func__); |
| 142 |
| 143 - detect_monotonic(); |
| 144 gettime(base, &base->event_tv); |
| 145 |
| 146 min_heap_ctor(&base->timeheap); |
| 147 @@ -868,7 +856,7 @@ timeout_correct(struct event_base *base, struct timeval *tv) |
| 148 unsigned int size; |
| 149 struct timeval off; |
| 150 |
| 151 - if (use_monotonic) |
| 152 + if (no_monotonic_clock == 0) |
| 153 return; |
| 154 |
| 155 /* Check if time is running backwards */ |
OLD | NEW |