summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2022-03-29 22:45:26 +0200
committerFernando Fernandez Mancera <ffmancera@riseup.net>2022-04-28 12:03:25 +0200
commit66237888e78aeae2f348b6b97c39c203a34ab7be (patch)
treeeb051a621f6f6f6db9537d5c2e3210812689241a
parent352e8bb86547f849ddd05cffce52a2e7760ce853 (diff)
glib-aux: add nm_utils_get_monotonic_timestamp_sec_cached() helper
(cherry picked from commit 3f4586532ffb8db2136bbb4ef906fd21d17d5bd2)
-rw-r--r--src/libnm-glib-aux/nm-time-utils.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libnm-glib-aux/nm-time-utils.h b/src/libnm-glib-aux/nm-time-utils.h
index 3c3e935f8d..461d6845fb 100644
--- a/src/libnm-glib-aux/nm-time-utils.h
+++ b/src/libnm-glib-aux/nm-time-utils.h
@@ -41,6 +41,12 @@ nm_utils_get_monotonic_timestamp_msec_cached(gint64 *cache_now)
return (*cache_now) ?: (*cache_now = nm_utils_get_monotonic_timestamp_msec());
}
+static inline gint32
+nm_utils_get_monotonic_timestamp_sec_cached(gint32 *cache_now)
+{
+ return (*cache_now) ?: (*cache_now = nm_utils_get_monotonic_timestamp_sec());
+}
+
gint64 nm_utils_clock_gettime_nsec(clockid_t clockid);
gint64 nm_utils_clock_gettime_msec(clockid_t clockid);