Index: runtime/vm/os_fuchsia.cc |
diff --git a/runtime/vm/os_fuchsia.cc b/runtime/vm/os_fuchsia.cc |
index d6b96711ecefe0f88524d577b8b5892adc291ed5..6c13dde3a4e243f2373027fcf5d1f5f230a6fe8c 100644 |
--- a/runtime/vm/os_fuchsia.cc |
+++ b/runtime/vm/os_fuchsia.cc |
@@ -10,6 +10,7 @@ |
#include <errno.h> |
#include <magenta/syscalls.h> |
#include <magenta/types.h> |
+#include <sys/time.h> |
#include "platform/assert.h" |
#include "vm/zone.h" |
@@ -77,7 +78,12 @@ int64_t OS::GetCurrentTimeMillis() { |
int64_t OS::GetCurrentTimeMicros() { |
- return mx_time_get(MX_CLOCK_MONOTONIC) / 1000; |
+ struct timeval tv; |
+ if (gettimeofday(&tv, NULL) < 0) { |
+ UNREACHABLE(); |
+ return 0; |
+ } |
+ return (static_cast<int64_t>(tv.tv_sec) * 1000000) + tv.tv_usec; |
} |