| 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(HOST_OS_FUCHSIA) | 6 #if defined(HOST_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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 } | 90 } |
| 91 | 91 |
| 92 | 92 |
| 93 int64_t TimerUtils::GetCurrentMonotonicMicros() { | 93 int64_t TimerUtils::GetCurrentMonotonicMicros() { |
| 94 int64_t ticks = mx_time_get(MX_CLOCK_MONOTONIC); | 94 int64_t ticks = mx_time_get(MX_CLOCK_MONOTONIC); |
| 95 return ticks / kNanosecondsPerMicrosecond; | 95 return ticks / kNanosecondsPerMicrosecond; |
| 96 } | 96 } |
| 97 | 97 |
| 98 | 98 |
| 99 void TimerUtils::Sleep(int64_t millis) { | 99 void TimerUtils::Sleep(int64_t millis) { |
| 100 mx_nanosleep(millis * kMicrosecondsPerMillisecond * | 100 mx_nanosleep(mx_deadline_after( |
| 101 kNanosecondsPerMicrosecond); | 101 millis * kMicrosecondsPerMillisecond * kNanosecondsPerMicrosecond)); |
| 102 } | 102 } |
| 103 | 103 |
| 104 } // namespace bin | 104 } // namespace bin |
| 105 } // namespace dart | 105 } // namespace dart |
| 106 | 106 |
| 107 #endif // defined(HOST_OS_FUCHSIA) | 107 #endif // defined(HOST_OS_FUCHSIA) |
| OLD | NEW |