1 diff --git a/third_party/libevent/evdns.c b/third_party/libevent/evdns.c
2 index f07ecc9..da6ea19 100644
3 --- a/third_party/libevent/evdns.c
4 +++ b/third_party/libevent/evdns.c
6 typedef ev_uint8_t u_char;
7 typedef unsigned int uint;
12 #define u64 ev_uint64_t
13 #define u32 ev_uint32_t
14 diff --git a/third_party/libevent/evdns.h b/third_party/libevent/evdns.h
15 index 1eb5c38..fca4ac3 100644
16 --- a/third_party/libevent/evdns.h
17 +++ b/third_party/libevent/evdns.h
18 @@ -165,7 +165,7 @@ extern "C" {
21 /* For integer types. */
25 /** Error codes 0-5 are as described in RFC 1035. */
26 #define DNS_ERR_NONE 0
27 diff --git a/third_party/libevent/event-config.h b/third_party/libevent/event-config.h
29 index 0000000..78a4727
31 +++ b/third_party/libevent/event-config.h
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.
37 +// This file is Chromium-specific, and brings in the appropriate
38 +// event-config.h depending on your platform.
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"
47 +#error generate event-config.h for your platform
49 diff --git a/third_party/libevent/event.h b/third_party/libevent/event.h
50 index cfa0fc3..72e9b8b 100644
51 --- a/third_party/libevent/event.h
52 +++ b/third_party/libevent/event.h
57 -#include <event-config.h>
58 +#include "event-config.h"
59 #ifdef _EVENT_HAVE_SYS_TYPES_H
60 #include <sys/types.h>
62 @@ -172,7 +172,7 @@ extern "C" {
70 #define WIN32_LEAN_AND_MEAN
71 diff --git a/third_party/libevent/evutil.h b/third_party/libevent/evutil.h
72 index dcb0013..8b664b9 100644
73 --- a/third_party/libevent/evutil.h
74 +++ b/third_party/libevent/evutil.h
79 -#include <event-config.h>
80 +#include "event-config.h"
81 #ifdef _EVENT_HAVE_SYS_TIME_H
84 diff --git a/third_party/libevent/README.chromium b/third_party/libevent/README.chromium
85 index 9969566..7e5f8ba 100644
86 diff --git a/third_party/libevent/event.c b/third_party/libevent/event.c
87 index 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[] = {
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;
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 *);
104 -detect_monotonic(void)
106 -#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
107 - struct timespec ts;
109 - if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0)
115 gettime(struct event_base *base, struct timeval *tp)
117 @@ -140,18 +129,18 @@ gettime(struct event_base *base, struct timeval *tp)
120 #if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
121 - if (use_monotonic) {
122 - struct timespec ts;
124 - if (clock_gettime(CLOCK_MONOTONIC, &ts) == -1)
126 + struct timespec ts;
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;
138 return (evutil_gettimeofday(tp, NULL));
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__);
145 - detect_monotonic();
146 gettime(base, &base->event_tv);
148 min_heap_ctor(&base->timeheap);