| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/globals.h" | 5 #include "platform/globals.h" |
| 6 #if defined(TARGET_OS_FUCHSIA) | 6 #if defined(TARGET_OS_FUCHSIA) |
| 7 | 7 |
| 8 #include <errno.h> | 8 #include <errno.h> |
| 9 #include <magenta/syscalls.h> | 9 #include <magenta/syscalls.h> |
| 10 #include <magenta/types.h> | 10 #include <magenta/types.h> |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 void TimerUtils::InitOnce() { | 81 void TimerUtils::InitOnce() { |
| 82 } | 82 } |
| 83 | 83 |
| 84 | 84 |
| 85 int64_t TimerUtils::GetCurrentMonotonicMillis() { | 85 int64_t TimerUtils::GetCurrentMonotonicMillis() { |
| 86 return GetCurrentMonotonicMicros() / 1000; | 86 return GetCurrentMonotonicMicros() / 1000; |
| 87 } | 87 } |
| 88 | 88 |
| 89 | 89 |
| 90 int64_t TimerUtils::GetCurrentMonotonicMicros() { | 90 int64_t TimerUtils::GetCurrentMonotonicMicros() { |
| 91 int64_t ticks = mx_current_time(); | 91 int64_t ticks = mx_time_get(MX_CLOCK_MONOTONIC); |
| 92 return ticks / kNanosecondsPerMicrosecond; | 92 return ticks / kNanosecondsPerMicrosecond; |
| 93 } | 93 } |
| 94 | 94 |
| 95 | 95 |
| 96 void TimerUtils::Sleep(int64_t millis) { | 96 void TimerUtils::Sleep(int64_t millis) { |
| 97 mx_nanosleep( | 97 mx_nanosleep( |
| 98 millis * kMicrosecondsPerMillisecond * kNanosecondsPerMicrosecond); | 98 millis * kMicrosecondsPerMillisecond * kNanosecondsPerMicrosecond); |
| 99 } | 99 } |
| 100 | 100 |
| 101 } // namespace bin | 101 } // namespace bin |
| 102 } // namespace dart | 102 } // namespace dart |
| 103 | 103 |
| 104 #endif // defined(TARGET_OS_FUCHSIA) | 104 #endif // defined(TARGET_OS_FUCHSIA) |
| OLD | NEW |