diff options
| author | Sebastien Bacher <seb128@ubuntu.com> | 2019-08-09 11:09:27 +0200 |
|---|---|---|
| committer | Sebastien Bacher <seb128@ubuntu.com> | 2019-08-09 11:18:39 +0200 |
| commit | 820498b2158e0b05421ce0922f203a0699927fa8 (patch) | |
| tree | 3bf6d1089b762535ec5e59738d47ae2d2f54750f /shared/systemd/src/basic/time-util.h | |
| parent | 1bd9f376796563dfb5016bada66c78b203f41d33 (diff) | |
| parent | 488dda3930545969f5644b57cfca81e21df031c3 (diff) | |
Merge remote-tracking branch 'salsa/master'
Diffstat (limited to 'shared/systemd/src/basic/time-util.h')
| -rw-r--r-- | shared/systemd/src/basic/time-util.h | 14 |
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); |