aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Zaborowski <andrew.zaborowski@intel.com>2022-10-26 15:15:53 +0200
committerDenis Kenzior <denkenz@gmail.com>2022-10-28 13:21:06 -0500
commitf57ac2b624ea423b9a7d3c784f0be36653501ddf (patch)
treed39f9888ffaa6b39e4cf08ae2f06235487e50e9f
parent1c93233e19e33f0868dbe75dc3059613a8abe0e2 (diff)
time: Add time_realtime_now
-rw-r--r--ell/time-private.h1
-rw-r--r--ell/time.c8
2 files changed, 9 insertions, 0 deletions
diff --git a/ell/time-private.h b/ell/time-private.h
index 83c23dde..e1075034 100644
--- a/ell/time-private.h
+++ b/ell/time-private.h
@@ -24,3 +24,4 @@ uint64_t _time_pick_interval_secs(uint32_t min_secs, uint32_t max_secs);
uint64_t _time_fuzz_msecs(uint64_t ms);
uint64_t _time_fuzz_secs(uint32_t secs, uint32_t max_offset);
uint64_t _time_realtime_to_boottime(const struct timeval *ts);
+uint64_t time_realtime_now(void);
diff --git a/ell/time.c b/ell/time.c
index 41e57250..2eac6c4c 100644
--- a/ell/time.c
+++ b/ell/time.c
@@ -58,6 +58,14 @@ LIB_EXPORT uint64_t l_time_now(void)
return _time_from_timespec(&now);
}
+uint64_t time_realtime_now(void)
+{
+ struct timespec now;
+
+ clock_gettime(CLOCK_REALTIME, &now);
+ return _time_from_timespec(&now);
+}
+
/**
* l_time_after
*