OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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_MACOS) | 6 #if defined(TARGET_OS_MACOS) |
7 | 7 |
8 #include <errno.h> // NOLINT | 8 #include <errno.h> // NOLINT |
9 #include <netdb.h> // NOLINT | 9 #include <netdb.h> // NOLINT |
10 #include <sys/time.h> // NOLINT | 10 #include <sys/time.h> // NOLINT |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 80 |
81 int64_t TimerUtils::GetCurrentTimeMicros() { | 81 int64_t TimerUtils::GetCurrentTimeMicros() { |
82 struct timeval tv; | 82 struct timeval tv; |
83 if (gettimeofday(&tv, NULL) < 0) { | 83 if (gettimeofday(&tv, NULL) < 0) { |
84 UNREACHABLE(); | 84 UNREACHABLE(); |
85 return 0; | 85 return 0; |
86 } | 86 } |
87 return (static_cast<int64_t>(tv.tv_sec) * 1000000) + tv.tv_usec; | 87 return (static_cast<int64_t>(tv.tv_sec) * 1000000) + tv.tv_usec; |
88 } | 88 } |
89 | 89 |
| 90 void TimerUtils::Sleep(int64_t millis) { |
| 91 usleep(millis * 1000); |
| 92 } |
| 93 |
90 #endif // defined(TARGET_OS_MACOS) | 94 #endif // defined(TARGET_OS_MACOS) |
OLD | NEW |