diff options
author | Andrew Zaborowski <andrew.zaborowski@intel.com> | 2022-10-26 15:15:53 +0200 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2022-10-28 13:21:06 -0500 |
commit | f57ac2b624ea423b9a7d3c784f0be36653501ddf (patch) | |
tree | d39f9888ffaa6b39e4cf08ae2f06235487e50e9f | |
parent | 1c93233e19e33f0868dbe75dc3059613a8abe0e2 (diff) |
time: Add time_realtime_now
-rw-r--r-- | ell/time-private.h | 1 | ||||
-rw-r--r-- | ell/time.c | 8 |
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); @@ -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 * |