| 162 | |
| 163 | |
| 164 | double EventLoop::time() |
| 165 | { |
| 166 | // We explicitly call `evutil_gettimeofday()` for now to avoid any |
| 167 | // issues that may be introduced by using the cached value provided |
| 168 | // by `event_base_gettimeofday_cached()`. Since a lot of logic in |
| 169 | // libprocess depends on time math, we want to log fatal rather than |
| 170 | // cause logic errors if the time fails. |
| 171 | timeval t; |
| 172 | if (evutil_gettimeofday(&t, nullptr) < 0) { |
| 173 | LOG(FATAL) << "Failed to get time, evutil_gettimeofday"; |
| 174 | } |
| 175 | |
| 176 | return Duration(t).secs(); |
| 177 | } |
| 178 | |
| 179 | |
| 180 | void EventLoop::initialize() |