Upgraded the rest of Time.
Change-Id: I0ee083837e51d8f74a798b7ba14a3b6bb3859f35
diff --git a/aos/common/event.cc b/aos/common/event.cc
index af9c9c5..ffb62b4 100644
--- a/aos/common/event.cc
+++ b/aos/common/event.cc
@@ -1,5 +1,7 @@
#include "aos/common/event.h"
+#include <chrono>
+
#include "aos/common/type_traits.h"
#include "aos/common/logging/logging.h"
@@ -20,8 +22,14 @@
}
}
-bool Event::WaitTimeout(const ::aos::time::Time &timeout) {
- const auto timeout_timespec = timeout.ToTimespec();
+bool Event::WaitTimeout(monotonic_clock::duration timeout) {
+ ::std::chrono::seconds sec =
+ ::std::chrono::duration_cast<::std::chrono::seconds>(timeout);
+ ::std::chrono::nanoseconds nsec =
+ ::std::chrono::duration_cast<::std::chrono::nanoseconds>(timeout - sec);
+ struct timespec timeout_timespec;
+ timeout_timespec.tv_sec = sec.count();
+ timeout_timespec.tv_nsec = nsec.count();
while (true) {
if (__atomic_load_n(&impl_, __ATOMIC_SEQ_CST) != 0) {
return true;