]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: use timestamp_is_set()
authorFrantisek Sumsal <frantisek@sumsal.cz>
Tue, 26 Dec 2023 19:23:19 +0000 (20:23 +0100)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Wed, 27 Dec 2023 10:15:48 +0000 (11:15 +0100)
src/test/test-time-util.c

index 76931ce0ab30d733b003b4b8fe0708d3ecc84010..d29afa38dd29a2dcea5dae4a48273081087e2f1b 100644 (file)
@@ -1089,9 +1089,9 @@ TEST(map_clock_usec) {
         assert_se(nowr < USEC_INFINITY - USEC_PER_DAY*7); /* overflow check */
         x = nowr + USEC_PER_DAY*7; /* 1 week from now */
         y = map_clock_usec(x, CLOCK_REALTIME, CLOCK_MONOTONIC);
-        assert_se(y > 0 && y < USEC_INFINITY);
+        assert_se(timestamp_is_set(y));
         z = map_clock_usec(y, CLOCK_MONOTONIC, CLOCK_REALTIME);
-        assert_se(z > 0 && z < USEC_INFINITY);
+        assert_se(timestamp_is_set(z));
         assert_se((z > x ? z - x : x - z) < USEC_PER_HOUR);
 
         assert_se(nowr > USEC_PER_DAY * 7); /* underflow check */
@@ -1100,7 +1100,7 @@ TEST(map_clock_usec) {
         if (y != 0) { /* might underflow if machine is not up long enough for the monotonic clock to be beyond 1w */
                 assert_se(y < USEC_INFINITY);
                 z = map_clock_usec(y, CLOCK_MONOTONIC, CLOCK_REALTIME);
-                assert_se(z > 0 && z < USEC_INFINITY);
+                assert_se(timestamp_is_set(z));
                 assert_se((z > x ? z - x : x - z) < USEC_PER_HOUR);
         }
 }