about summary refs log tree commit diff
path: root/shared/systemd/src/basic/time-util.h
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2019-07-31 10:52:41 +0200
committerMichael Biebl <biebl@debian.org>2019-07-31 10:52:41 +0200
commit3a99ba5fd066fe42bd5461360a7411766496619c (patch)
treeb43863fbe867d7b0f9f9032fd40664c521c88fcb /shared/systemd/src/basic/time-util.h
parent13cfe714153013158bdf3e74ab58ab713a04223c (diff)
parent2e5fa45ddfbb5cffa1e78221f1cea706e2f298af (diff)
Update upstream source from tag 'upstream/1.19.90'
Update to upstream version '1.19.90'
with Debian dir 6d1a5b9902866beee1365904d425141b5d4c944c
Diffstat (limited to 'shared/systemd/src/basic/time-util.h')
-rw-r--r--shared/systemd/src/basic/time-util.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/shared/systemd/src/basic/time-util.h b/shared/systemd/src/basic/time-util.h
index a238f691..e3a529d9 100644
--- a/shared/systemd/src/basic/time-util.h
+++ b/shared/systemd/src/basic/time-util.h
@@ -81,15 +81,19 @@ triple_timestamp* triple_timestamp_from_realtime(triple_timestamp *ts, usec_t u)
 #define TRIPLE_TIMESTAMP_HAS_CLOCK(clock)                               \
         IN_SET(clock, CLOCK_REALTIME, CLOCK_REALTIME_ALARM, CLOCK_MONOTONIC, CLOCK_BOOTTIME, CLOCK_BOOTTIME_ALARM)
 
+static inline bool timestamp_is_set(usec_t timestamp) {
+        return timestamp > 0 && timestamp != USEC_INFINITY;
+}
+
 static inline bool dual_timestamp_is_set(const dual_timestamp *ts) {
-        return ((ts->realtime > 0 && ts->realtime != USEC_INFINITY) ||
-                (ts->monotonic > 0 && ts->monotonic != USEC_INFINITY));
+        return timestamp_is_set(ts->realtime) ||
+               timestamp_is_set(ts->monotonic);
 }
 
 static inline bool triple_timestamp_is_set(const triple_timestamp *ts) {
-        return ((ts->realtime > 0 && ts->realtime != USEC_INFINITY) ||
-                (ts->monotonic > 0 && ts->monotonic != USEC_INFINITY) ||
-                (ts->boottime > 0 && ts->boottime != USEC_INFINITY));
+        return timestamp_is_set(ts->realtime) ||
+               timestamp_is_set(ts->monotonic) ||
+               timestamp_is_set(ts->boottime);
 }
 
 usec_t triple_timestamp_by_clock(triple_timestamp *ts, clockid_t clock);