tests: show current monotonic/boottime/realtime clock values in test-time
authorLennart Poettering <lennart@poettering.net>
Thu, 22 Jun 2017 19:10:34 +0000 (21:10 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 22 Jun 2017 19:10:34 +0000 (21:10 +0200)
When debugging time issues its kinda handy to have an easy way to query
the three clocks, hence let's just output them at the beginning of
test-time.

src/test/test-time.c

index d9a6d61..601e835 100644 (file)
@@ -372,6 +372,13 @@ static void test_usec_shift_clock(void) {
 int main(int argc, char *argv[]) {
         uintmax_t x;
 
+        log_info("realtime=" USEC_FMT "\n"
+                 "monotonic=" USEC_FMT "\n"
+                 "boottime=" USEC_FMT "\n",
+                 now(CLOCK_REALTIME),
+                 now(CLOCK_MONOTONIC),
+                 now(clock_boottime_or_monotonic()));
+
         test_parse_sec();
         test_parse_time();
         test_parse_nsec();