[fuchsia] Update to Sync2Ptr
This change is part of a large-scale change to the return value of
synchronous pointer methods. The "statvs" property is temporary and will
be removed once hte transition is complete.
Change-Id: I92cdf168fbb2a8b5e843de8130afb82463313ef2
Reviewed-on: https://dart-review.googlesource.com/62401
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Adam Barth <abarth@google.com>
diff --git a/runtime/vm/os_fuchsia.cc b/runtime/vm/os_fuchsia.cc
index e8ed9aa..e97f30c 100644
--- a/runtime/vm/os_fuchsia.cc
+++ b/runtime/vm/os_fuchsia.cc
@@ -43,11 +43,13 @@
static zx_status_t GetLocalAndDstOffsetInSeconds(int64_t seconds_since_epoch,
int32_t* local_offset,
int32_t* dst_offset) {
- fuchsia::timezone::TimezoneSyncPtr time_svc;
- fuchsia::sys::ConnectToEnvironmentService(time_svc.NewRequest());
- if (!time_svc->GetTimezoneOffsetMinutes(seconds_since_epoch * 1000,
- local_offset, dst_offset))
- return ZX_ERR_UNAVAILABLE;
+ fuchsia::timezone::TimezoneSync2Ptr tz;
+ fuchsia::sys::ConnectToEnvironmentService(tz.NewRequest());
+ zx_status_t status = tz->GetTimezoneOffsetMinutes(seconds_since_epoch * 1000,
+ local_offset,
+ dst_offset).statvs;
+ if (status != ZX_OK)
+ return status;
*local_offset *= 60;
*dst_offset *= 60;
return ZX_OK;
@@ -56,10 +58,10 @@
const char* OS::GetTimeZoneName(int64_t seconds_since_epoch) {
// TODO(abarth): Handle time zone changes.
static const auto* tz_name = new std::string([] {
- fuchsia::timezone::TimezoneSyncPtr time_svc;
- fuchsia::sys::ConnectToEnvironmentService(time_svc.NewRequest());
+ fuchsia::timezone::TimezoneSyncPtr tz;
+ fuchsia::sys::ConnectToEnvironmentService(tz.NewRequest());
fidl::StringPtr result;
- time_svc->GetTimezoneId(&result);
+ tz->GetTimezoneId(&result);
return *result;
}());
return tz_name->c_str();