diff options
Diffstat (limited to '')
-rw-r--r-- | libnetdata/clocks/clocks.h (renamed from src/clocks.h) | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/clocks.h b/libnetdata/clocks/clocks.h index ca5715254..d576d86b9 100644 --- a/src/clocks.h +++ b/libnetdata/clocks/clocks.h @@ -1,6 +1,10 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + #ifndef NETDATA_CLOCKS_H #define NETDATA_CLOCKS_H 1 +#include "../libnetdata.h" + #ifndef HAVE_STRUCT_TIMESPEC struct timespec { time_t tv_sec; /* seconds */ @@ -17,7 +21,10 @@ typedef unsigned long long msec_t; typedef unsigned long long usec_t; typedef long long susec_t; -typedef usec_t heartbeat_t; +typedef struct heartbeat { + usec_t monotonic; + usec_t realtime; +} heartbeat_t; /* Linux value is as good as any other */ #ifndef CLOCK_REALTIME @@ -105,7 +112,7 @@ extern time_t now_boottime_sec(void); extern usec_t now_boottime_usec(void); -extern usec_t timeval_usec(struct timeval *ts); +extern usec_t timeval_usec(struct timeval *tv); extern msec_t timeval_msec(struct timeval *tv); extern usec_t dt_usec(struct timeval *now, struct timeval *old); @@ -119,6 +126,8 @@ extern void heartbeat_init(heartbeat_t *hb); extern usec_t heartbeat_next(heartbeat_t *hb, usec_t tick); /* Returns elapsed time in microseconds since last heartbeat */ -extern usec_t heartbeat_dt_usec(heartbeat_t *hb); +extern usec_t heartbeat_monotonic_dt_to_now_usec(heartbeat_t *hb); + +extern int sleep_usec(usec_t usec); #endif /* NETDATA_CLOCKS_H */ |