[fuchsia] Migrate to zx_clock_get_new
Change-Id: Ibf9210e3965e77ff56d244cfd67dbccfb1eef3f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102104
Auto-Submit: Adam Barth <abarth@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
diff --git a/runtime/bin/utils_fuchsia.cc b/runtime/bin/utils_fuchsia.cc
index 4c8b208..c7bbe08 100644
--- a/runtime/bin/utils_fuchsia.cc
+++ b/runtime/bin/utils_fuchsia.cc
@@ -77,7 +77,7 @@
}
int64_t TimerUtils::GetCurrentMonotonicMicros() {
- int64_t ticks = zx_clock_get(ZX_CLOCK_MONOTONIC);
+ zx_time_t ticks = zx_clock_get_monotonic();
return ticks / kNanosecondsPerMicrosecond;
}
diff --git a/runtime/vm/os_fuchsia.cc b/runtime/vm/os_fuchsia.cc
index 58acf87..869c5b2 100644
--- a/runtime/vm/os_fuchsia.cc
+++ b/runtime/vm/os_fuchsia.cc
@@ -89,8 +89,10 @@
int OS::GetLocalTimeZoneAdjustmentInSeconds() {
int32_t local_offset, dst_offset;
+ zx_time_t now = 0;
+ zx_clock_get_new(ZX_CLOCK_UTC, &now);
zx_status_t status = GetLocalAndDstOffsetInSeconds(
- zx_clock_get(ZX_CLOCK_UTC) / ZX_SEC(1), &local_offset, &dst_offset);
+ now / ZX_SEC(1), &local_offset, &dst_offset);
return status == ZX_OK ? local_offset : 0;
}
@@ -99,11 +101,13 @@
}
int64_t OS::GetCurrentTimeMicros() {
- return zx_clock_get(ZX_CLOCK_UTC) / kNanosecondsPerMicrosecond;
+ zx_time_t now = 0;
+ zx_clock_get_new(ZX_CLOCK_UTC, &now);
+ return now / kNanosecondsPerMicrosecond;
}
int64_t OS::GetCurrentMonotonicTicks() {
- return zx_clock_get(ZX_CLOCK_MONOTONIC);
+ return zx_clock_get_monotonic();
}
int64_t OS::GetCurrentMonotonicFrequency() {
@@ -117,7 +121,9 @@
}
int64_t OS::GetCurrentThreadCPUMicros() {
- return zx_clock_get(ZX_CLOCK_THREAD) / kNanosecondsPerMicrosecond;
+ zx_time_t now = 0;
+ zx_clock_get_new(ZX_CLOCK_THREAD, &now);
+ return now / kNanosecondsPerMicrosecond;
}
// TODO(5411554): May need to hoist these architecture dependent code
diff --git a/runtime/vm/os_thread_fuchsia.cc b/runtime/vm/os_thread_fuchsia.cc
index d6fd956..01b2fe7 100644
--- a/runtime/vm/os_thread_fuchsia.cc
+++ b/runtime/vm/os_thread_fuchsia.cc
@@ -55,7 +55,7 @@
static void ComputeTimeSpecMicros(struct timespec* ts, int64_t micros) {
// time in nanoseconds.
- zx_time_t now = zx_clock_get(ZX_CLOCK_MONOTONIC);
+ zx_time_t now = zx_clock_get_monotonic();
zx_time_t target = now + (micros * kNanosecondsPerMicrosecond);
int64_t secs = target / kNanosecondsPerSecond;
int64_t nanos = target - (secs * kNanosecondsPerSecond);