# Timer

## NAME

timer - An object that may be signaled at some point in the future

## SYNOPSIS

A timer is used to wait until a specified point in time has occurred
or the timer has been canceled.

## DESCRIPTION

Like other waitable objects, timers can be waited on via
[`zx_object_wait_one()`](https://fuchsia.dev/reference/syscalls/object_wait_one), [`zx_object_wait_many()`](https://fuchsia.dev/reference/syscalls/object_wait_many), or
[`zx_object_wait_async()`](https://fuchsia.dev/reference/syscalls/object_wait_async).

A given timer can be used over and over.

Once **ZX_TIMER_SIGNALED** is asserted, it will remain asserted until
the timer is canceled ([`zx_timer_cancel()`](https://fuchsia.dev/reference/syscalls/timer_cancel)) or reset ([`zx_timer_set()`](https://fuchsia.dev/reference/syscalls/timer_set)).

The typical lifecycle is:

1. `zx_timer_create()`
2. `zx_timer_set()`
3. wait for the timer to be signaled
4. optionally reset and reuse the timer (i.e. goto #2)
5. `zx_handle_close()`

## SYSCALLS

- [`zx_timer_create()`](https://fuchsia.dev/reference/syscalls/timer_create) - create a timer
- [`zx_timer_set()`](https://fuchsia.dev/reference/syscalls/timer_set) - set a timer
- [`zx_timer_cancel()`](https://fuchsia.dev/reference/syscalls/timer_cancel) - cancel a timer

## SEE ALSO

- [timer slack](https://fuchsia.dev/docs/concepts/kernel/timer_slack)

[](https://issues.fuchsia.dev/issues/new?component=1439230&template=1881640&description=Issue+on:+https://fuchsia.dev/docs/reference/kernel_objects/timer.md "Report a bug or suggest improvements on this page") [](https://cs.opensource.google/fuchsia/fuchsia/+/main:docs/reference/kernel_objects/timer.md "View the source code of this page") [](https://ci.android.com/edit?repo=fuchsia/fuchsia/main&file=docs/reference/kernel_objects/timer.md&cloneRepo=fuchsia/fuchsia:refs/heads/main&fullPath=fuchsia/docs/reference/kernel_objects/timer.md "Edit the source code of this page")