1# zx_ticks_per_second
2
3## NAME
4
5<!-- Updated by update-docs-from-abigen, do not edit. -->
6
7ticks_per_second - Read the number of high-precision timer ticks in a second.
8
9## SYNOPSIS
10
11<!-- Updated by update-docs-from-abigen, do not edit. -->
12
13```
14#include <zircon/syscalls.h>
15
16zx_ticks_t zx_ticks_per_second(void);
17```
18
19## DESCRIPTION
20
21`zx_ticks_per_second()` returns the number of high-precision timer ticks in a
22second.
23
24This can be used together with [`zx_ticks_get()`] to calculate the amount of
25time elapsed between two subsequent calls to [`zx_ticks_get()`].
26
27This value can vary from boot to boot of a given system. Once booted,
28this value is guaranteed not to change.
29
30## RIGHTS
31
32<!-- Updated by update-docs-from-abigen, do not edit. -->
33
34TODO(ZX-2399)
35
36## RETURN VALUE
37
38`zx_ticks_per_second()` returns the number of high-precision timer ticks in a
39second.
40
41## ERRORS
42
43`zx_ticks_per_second()` does not report any error conditions.
44
45## EXAMPLES
46
47```
48zx_ticks_t ticks_per_second = zx_ticks_per_second();
49zx_ticks_t ticks_start = zx_ticks_get();
50
51// do some more work
52
53zx_ticks_t ticks_end = zx_ticks_get();
54double elapsed_seconds = (ticks_end - ticks_start) / (double)ticks_per_second;
55
56```
57
58## SEE ALSO
59
60 - [`zx_ticks_get()`]
61
62<!-- References updated by update-docs-from-abigen, do not edit. -->
63
64[`zx_ticks_get()`]: ticks_get.md
65