Start a timer.
#include <zircon/syscalls.h> zx_status_t zx_timer_set(zx_handle_t handle, zx_time_t deadline, zx_duration_t slack);
zx_timer_set() starts a one-shot timer that will fire when
deadline passes. If a previous call to
pending, the previous timer is canceled and
ZX_TIMER_SIGNALED is de-asserted as needed.
The deadline parameter specifies a deadline with respect to
ZX_CLOCK_MONOTONIC. To wait for a relative interval,
zx_deadline_after() returned value in deadline.
To fire the timer immediately pass a deadline less than or equal to 0.
When the timer fires it asserts ZX_TIMER_SIGNALED. To de-assert this
The slack parameter specifies a range from deadline - slack to deadline + slack during which the timer is allowed to fire. The system uses this parameter as a hint to coalesce nearby timers.
The precise coalescing behavior is controlled by the options parameter specified when the timer was created. ZX_TIMER_SLACK_EARLY allows only firing in the deadline - slack interval and ZX_TIMER_SLACK_LATE allows only firing in the deadline + slack interval. The default option value of 0 is ZX_TIMER_SLACK_CENTER and allows both early and late firing with an effective interval of deadline - slack to deadline + slack
handle must be of type ZX_OBJ_TYPE_TIMER and have ZX_RIGHT_WRITE.
zx_timer_set() returns ZX_OK on success.
In the event of failure, a negative error value is returned.
ZX_ERR_BAD_HANDLE handle is not a valid handle.
ZX_ERR_ACCESS_DENIED handle lacks the right ZX_RIGHT_WRITE.
ZX_ERR_OUT_OF_RANGE slack is negative.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.