summaryrefslogtreecommitdiffstats
path: root/libnetdata/clocks/clocks.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2018-11-07 12:19:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2018-11-07 12:20:17 +0000
commita64a253794ac64cb40befee54db53bde17dd0d49 (patch)
treec1024acc5f6e508814b944d99f112259bb28b1be /libnetdata/clocks/clocks.h
parentNew upstream version 1.10.0+dfsg (diff)
downloadnetdata-a64a253794ac64cb40befee54db53bde17dd0d49.tar.xz
netdata-a64a253794ac64cb40befee54db53bde17dd0d49.zip
New upstream version 1.11.0+dfsgupstream/1.11.0+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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 */