diff options
Diffstat (limited to 'base/waitable_event_win.cc')
-rw-r--r-- | base/waitable_event_win.cc | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/base/waitable_event_win.cc b/base/waitable_event_win.cc index e23eea0..da2d2d8 100644 --- a/base/waitable_event_win.cc +++ b/base/waitable_event_win.cc @@ -29,7 +29,6 @@ #include "base/waitable_event.h" -#include <math.h> #include <windows.h> #include "base/logging.h" @@ -69,12 +68,8 @@ bool WaitableEvent::Wait() { } bool WaitableEvent::TimedWait(const TimeDelta& max_time) { - DCHECK(max_time >= TimeDelta::FromMicroseconds(0)); - // Be careful here. TimeDelta has a precision of microseconds, but this API - // is in milliseconds. If there are 5.5ms left, should the delay be 5 or 6? - // It should be 6 to avoid returning too early. - double timeout = ceil(max_time.InMillisecondsF()); - DWORD result = WaitForSingleObject(event_, static_cast<DWORD>(timeout)); + int32 timeout = static_cast<int32>(max_time.InMilliseconds()); + DWORD result = WaitForSingleObject(event_, timeout); switch (result) { case WAIT_OBJECT_0: return true; |