blob: 5aecb3bc1b7fab9ff0e5d5a191dcee135b74f099 [file] [log] [blame]
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// TODO(fxb/39732): This should be read as "library zx".
library zz;
enum Clock : uint32 {
MONOTONIC = 0;
UTC = 1;
THREAD = 2;
};
[Transport = "Syscall"]
protocol clock {
/// Acquire the current time.
clock_get(Clock clock_id) -> (status status, time out);
/// Acquire the current monotonic time.
[vdsocall]
clock_get_monotonic() -> (time time);
/// Rights: handle must have resource kind ZX_RSRC_KIND_ROOT.
clock_adjust(handle<resource> handle, Clock clock_id, int64 offset) -> (status status);
// Read clock monotonic, but demand that the read be performed using a
// syscall, instead of a vdso call.
//
// See the notes for ticks_get_via_kernel; this is not a syscall meant
// to be used by application code.
[internal]
clock_get_monotonic_via_kernel() -> (time time);
// TODO: handle<clock> for all of these.
/// Create a new clock object.
/// Rights: None.
clock_create(uint64 options, const_voidptr args) -> (status status, handle out);
/// Perform a basic read of the clock.
/// Rights: handle must be of type ZX_OBJ_TYPE_CLOCK and have ZX_RIGHT_READ.
clock_read(handle handle) -> (status status, time now);
/// Fetch all of the low level details of the clock's current status.
/// Rights: handle must be of type ZX_OBJ_TYPE_CLOCK and have ZX_RIGHT_READ.
clock_get_details(handle handle, uint64 options) -> (status status, voidptr details);
/// Make adjustments to a clock object.
/// Rights: handle must be of type ZX_OBJ_TYPE_CLOCK and have ZX_RIGHT_WRITE.
clock_update(handle handle, uint64 options, const_voidptr args) -> (status status);
};