1diff --git a/third_party/libevent/evdns.c b/third_party/libevent/evdns.c 2index f07ecc9..da6ea19 100644 3--- a/third_party/libevent/evdns.c 4+++ b/third_party/libevent/evdns.c 5@@ -134,7 +134,7 @@ 6 typedef ev_uint8_t u_char; 7 typedef unsigned int uint; 8 #endif 9-#include <event.h> 10+#include "event.h" 11 12 #define u64 ev_uint64_t 13 #define u32 ev_uint32_t 14diff --git a/third_party/libevent/evdns.h b/third_party/libevent/evdns.h 15index 1eb5c38..fca4ac3 100644 16--- a/third_party/libevent/evdns.h 17+++ b/third_party/libevent/evdns.h 18@@ -165,7 +165,7 @@ extern "C" { 19 #endif 20 21 /* For integer types. */ 22-#include <evutil.h> 23+#include "evutil.h" 24 25 /** Error codes 0-5 are as described in RFC 1035. */ 26 #define DNS_ERR_NONE 0 27diff --git a/third_party/libevent/event-config.h b/third_party/libevent/event-config.h 28new file mode 100644 29index 0000000..78a4727 30--- /dev/null 31+++ b/third_party/libevent/event-config.h 32@@ -0,0 +1,16 @@ 33+// Copyright (c) 2009 The Chromium Authors. All rights reserved. 34+// Use of this source code is governed by a BSD-style license that can be 35+// found in the LICENSE file. 36+ 37+// This file is Chromium-specific, and brings in the appropriate 38+// event-config.h depending on your platform. 39+ 40+#if defined(__APPLE__) 41+#include "mac/event-config.h" 42+#elif defined(__linux__) 43+#include "linux/event-config.h" 44+#elif defined(__FreeBSD__) 45+#include "freebsd/event-config.h" 46+#else 47+#error generate event-config.h for your platform 48+#endif 49diff --git a/third_party/libevent/event.h b/third_party/libevent/event.h 50index cfa0fc3..72e9b8b 100644 51--- a/third_party/libevent/event.h 52+++ b/third_party/libevent/event.h 53@@ -159,7 +159,7 @@ 54 extern "C" { 55 #endif 56 57-#include <event-config.h> 58+#include "event-config.h" 59 #ifdef _EVENT_HAVE_SYS_TYPES_H 60 #include <sys/types.h> 61 #endif 62@@ -172,7 +172,7 @@ extern "C" { 63 #include <stdarg.h> 64 65 /* For int types. */ 66-#include <evutil.h> 67+#include "evutil.h" 68 69 #ifdef WIN32 70 #define WIN32_LEAN_AND_MEAN 71diff --git a/third_party/libevent/evutil.h b/third_party/libevent/evutil.h 72index dcb0013..8b664b9 100644 73--- a/third_party/libevent/evutil.h 74+++ b/third_party/libevent/evutil.h 75@@ -38,7 +38,7 @@ 76 extern "C" { 77 #endif 78 79-#include <event-config.h> 80+#include "event-config.h" 81 #ifdef _EVENT_HAVE_SYS_TIME_H 82 #include <sys/time.h> 83 #endif 84diff --git a/third_party/libevent/README.chromium b/third_party/libevent/README.chromium 85index 9969566..7e5f8ba 100644 86diff --git a/third_party/libevent/event.c b/third_party/libevent/event.c 87index 1253352..8b6cae5 100644 88--- a/third_party/libevent/event.c 89+++ b/third_party/libevent/event.c 90@@ -107,7 +107,7 @@ static const struct eventop *eventops[] = { 91 /* Global state */ 92 struct event_base *current_base = NULL; 93 extern struct event_base *evsignal_base; 94-static int use_monotonic; 95+static int use_monotonic = 1; 96 97 /* Prototypes */ 98 static void event_queue_insert(struct event_base *, struct event *, int); 99@@ -120,17 +120,6 @@ static int timeout_next(struct event_base *, struct timeval **); 100 static void timeout_process(struct event_base *); 101 static void timeout_correct(struct event_base *, struct timeval *); 102 103-static void 104-detect_monotonic(void) 105-{ 106-#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC) 107- struct timespec ts; 108- 109- if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) 110- use_monotonic = 1; 111-#endif 112-} 113- 114 static int 115 gettime(struct event_base *base, struct timeval *tp) 116 { 117@@ -140,18 +129,18 @@ gettime(struct event_base *base, struct timeval *tp) 118 } 119 120 #if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC) 121- if (use_monotonic) { 122- struct timespec ts; 123- 124- if (clock_gettime(CLOCK_MONOTONIC, &ts) == -1) 125- return (-1); 126+ struct timespec ts; 127 128+ if (use_monotonic && 129+ clock_gettime(CLOCK_MONOTONIC, &ts) == 0) { 130 tp->tv_sec = ts.tv_sec; 131 tp->tv_usec = ts.tv_nsec / 1000; 132 return (0); 133 } 134 #endif 135 136+ use_monotonic = 0; 137+ 138 return (evutil_gettimeofday(tp, NULL)); 139 } 140 141@@ -175,7 +164,6 @@ event_base_new(void) 142 if ((base = calloc(1, sizeof(struct event_base))) == NULL) 143 event_err(1, "%s: calloc", __func__); 144 145- detect_monotonic(); 146 gettime(base, &base->event_tv); 147 148 min_heap_ctor(&base->timeheap); 149