Repository: mesos
Updated Branches:
  refs/heads/master 6edbedd19 -> d6685e492


Libevent: Used `evutil_gettimeofday` to implement `time()`.

This used to be implemented by `event_base_gettimeofday_cached()`. We
want to avoid cached results in case they introduce any issues.

Review: https://reviews.apache.org/r/37907


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/d6685e49
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/d6685e49
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/d6685e49

Branch: refs/heads/master
Commit: d6685e4922f273078352f4674e7bc1ca9e42dbba
Parents: 6edbedd
Author: Joris Van Remoortere <[email protected]>
Authored: Fri Aug 28 17:50:49 2015 -0400
Committer: Joris Van Remoortere <[email protected]>
Committed: Mon Aug 31 09:31:47 2015 -0400

----------------------------------------------------------------------
 3rdparty/libprocess/src/libevent.cpp | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/d6685e49/3rdparty/libprocess/src/libevent.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/libevent.cpp 
b/3rdparty/libprocess/src/libevent.cpp
index d7c47fb..ee79064 100644
--- a/3rdparty/libprocess/src/libevent.cpp
+++ b/3rdparty/libprocess/src/libevent.cpp
@@ -19,6 +19,7 @@
 
 #include <event2/event.h>
 #include <event2/thread.h>
+#include <event2/util.h>
 
 #include <process/logging.hpp>
 #include <process/once.hpp>
@@ -170,13 +171,14 @@ void EventLoop::delay(
 
 double EventLoop::time()
 {
-  // Get the cached time if running the event loop, or call
-  // gettimeofday() to get the current time. Since a lot of logic in
+  // We explicitly call `evutil_gettimeofday()` for now to avoid any
+  // issues that may be introduced by using the cached value provided
+  // by `event_base_gettimeofday_cached()`. Since a lot of logic in
   // libprocess depends on time math, we want to log fatal rather than
   // cause logic errors if the time fails.
   timeval t;
-  if (event_base_gettimeofday_cached(base, &t) < 0) {
-    LOG(FATAL) << "Failed to get time, event_base_gettimeofday_cached";
+  if (evutil_gettimeofday(&t, NULL) < 0) {
+    LOG(FATAL) << "Failed to get time, evutil_gettimeofday";
   }
 
   return Duration(t).secs();

Reply via email to