about summary refs log tree commit diff
path: root/support/xtime.h
diff options
context:
space:
mode:
Diffstat (limited to 'support/xtime.h')
-rw-r--r--support/xtime.h10
1 files changed, 10 insertions, 0 deletions
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 */