chiark / gitweb /
time-util: use dual_timestamp_get()
authorAlexander Kuleshov <kuleshovmail@gmail.com>
Thu, 4 Feb 2016 19:03:23 +0000 (01:03 +0600)
committerSven Eden <yamakuzure@gmx.net>
Wed, 17 May 2017 13:22:16 +0000 (15:22 +0200)
The time-util.c provides dual_timestamp_get() function for getting
realtime and monotonic timestamps. Let's use it instead of direct
realtime/monotonic calculation.

src/basic/time-util.c

index 34061fe..28b20f4 100644 (file)
@@ -112,9 +112,8 @@ dual_timestamp* dual_timestamp_from_boottime_or_monotonic(dual_timestamp *ts, us
                 ts->realtime = ts->monotonic = USEC_INFINITY;
                 return ts;
         }
                 ts->realtime = ts->monotonic = USEC_INFINITY;
                 return ts;
         }
-        ts->realtime = now(CLOCK_REALTIME);
-        ts->monotonic = now(CLOCK_MONOTONIC);
 
 
+        dual_timestamp_get(ts);
         delta = (int64_t) now(clock_boottime_or_monotonic()) - (int64_t) u;
 
         if ((int64_t) ts->realtime > delta)
         delta = (int64_t) now(clock_boottime_or_monotonic()) - (int64_t) u;
 
         if ((int64_t) ts->realtime > delta)