[PATCH 1/6] time: Add time_realtime_now
Andrew Zaborowski <[email protected]>
| Newsgroups | dev.linux.lists.ell |
|---|---|
| Message-ID | <[email protected]> |
---
ell/time-private.h | 1 +
ell/time.c | 8 ++++++++
2 files changed, 9 insertions(+)
diff --git a/ell/time-private.h b/ell/time-private.h
index 83c23dd..e107503 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 41e5725..2eac6c4 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
*
--
2.34.1