aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--support/xtime.h10
2 files changed, 14 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 05291d7825..de58169b61 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2019-06-20 Mike Crowe <mac@mcrowe.com>
+
+ * support/xtime.h: Add xclock_now() helper function.
+
2019-06-20 Dmitry V. Levin <ldv@altlinux.org>
Florian Weimer <fweimer@redhat.com>
diff --git a/support/xtime.h b/support/xtime.h
index 68af1a59d7..6e19ce177f 100644
--- a/support/xtime.h
+++ b/support/xtime.h
@@ -28,6 +28,16 @@ __BEGIN_DECLS
void xclock_gettime (clockid_t clock, struct timespec *ts);
+/* This helper can often simplify tests by avoiding an explicit
+ variable declaration or allowing that declaration to be const. */
+
+static inline struct timespec xclock_now (clockid_t clock)
+{
+ struct timespec ts;
+ xclock_gettime (clock, &ts);
+ return ts;
+}
+
__END_DECLS
#endif /* SUPPORT_TIME_H */