1#ifndef JEMALLOC_INTERNAL_NSTIME_H
2#define JEMALLOC_INTERNAL_NSTIME_H
3
4/* Maximum supported number of seconds (~584 years). */
5#define NSTIME_SEC_MAX KQU(18446744072)
6#define NSTIME_ZERO_INITIALIZER {0}
7
8typedef struct {
9 uint64_t ns;
10} nstime_t;
11
12void nstime_init(nstime_t *time, uint64_t ns);
13void nstime_init2(nstime_t *time, uint64_t sec, uint64_t nsec);
14uint64_t nstime_ns(const nstime_t *time);
15uint64_t nstime_sec(const nstime_t *time);
16uint64_t nstime_msec(const nstime_t *time);
17uint64_t nstime_nsec(const nstime_t *time);
18void nstime_copy(nstime_t *time, const nstime_t *source);
19int nstime_compare(const nstime_t *a, const nstime_t *b);
20void nstime_add(nstime_t *time, const nstime_t *addend);
21void nstime_iadd(nstime_t *time, uint64_t addend);
22void nstime_subtract(nstime_t *time, const nstime_t *subtrahend);
23void nstime_isubtract(nstime_t *time, uint64_t subtrahend);
24void nstime_imultiply(nstime_t *time, uint64_t multiplier);
25void nstime_idivide(nstime_t *time, uint64_t divisor);
26uint64_t nstime_divide(const nstime_t *time, const nstime_t *divisor);
27
28typedef bool (nstime_monotonic_t)(void);
29extern nstime_monotonic_t *JET_MUTABLE nstime_monotonic;
30
31typedef bool (nstime_update_t)(nstime_t *);
32extern nstime_update_t *JET_MUTABLE nstime_update;
33
34#endif /* JEMALLOC_INTERNAL_NSTIME_H */
35