[fuchsia] Add wrapper for zx_clock_get_monotonic. (#23128)

Bug: https://github.com/flutter/flutter/issues/72321

Co-authored-by: Jody Sankey <jsankey@google.com>
This commit is contained in:
Jody Sankey 2020-12-17 10:55:29 -08:00 committed by GitHub
parent 76310c4264
commit 6e54f0d2df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 0 deletions

View File

@ -189,6 +189,7 @@ class System extends NativeFieldWrapperClass2 {
static MapResult vmoMap(Handle vmo) native 'System_VmoMap';
// Time operations.
static int clockGetMonotonic() native 'System_ClockGetMonotonic';
static int clockGet(int clockId) native 'System_ClockGet';
// TODO(edcoyne): Remove this, it is required to safely do an API transition across repos.

View File

@ -459,6 +459,10 @@ Dart_Handle System::VmoMap(fml::RefPtr<Handle> vmo) {
return ConstructDartObject(kMapResult, ToDart(ZX_OK), object);
}
uint64_t System::ClockGetMonotonic() {
return zx_clock_get_monotonic();
}
uint64_t System::ClockGet(uint32_t clock_id) {
zx_time_t result = 0;
zx_clock_get(clock_id, &result);

View File

@ -61,6 +61,8 @@ class System : public fml::RefCountedThreadSafe<System>,
static Dart_Handle VmoMap(fml::RefPtr<Handle> vmo);
static uint64_t ClockGetMonotonic();
static uint64_t ClockGet(uint32_t clock_id);
static void RegisterNatives(tonic::DartLibraryNatives* natives);