aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/compat_time.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/common/compat_time.c b/src/common/compat_time.c
index de3956685a..b7d69cf400 100644
--- a/src/common/compat_time.c
+++ b/src/common/compat_time.c
@@ -466,6 +466,10 @@ uint64_t
monotime_absolute_nsec(void)
{
monotime_t now;
+ if (BUG(monotime_initialized == 0)) {
+ monotime_init();
+ }
+
monotime_get(&now);
return monotime_diff_nsec(&initialized_at, &now);
}
@@ -486,6 +490,10 @@ monotime_absolute_msec(void)
uint64_t
monotime_coarse_absolute_nsec(void)
{
+ if (BUG(monotime_initialized == 0)) {
+ monotime_init();
+ }
+
monotime_coarse_t now;
monotime_coarse_get(&now);
return monotime_coarse_diff_nsec(&initialized_at_coarse, &now);