]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tree-wide: fall back to now(CLOCK_MONOTONIC) if CLOCK_BOOTTIME unsupported (#3037)
authorLubomir Rintel <lkundrak@v3.sk>
Mon, 18 Apr 2016 01:45:42 +0000 (03:45 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 18 Apr 2016 01:45:42 +0000 (21:45 -0400)
It was added in 2.6.39, and causes an assertion to fail when running in mock
hosted on 2.6.32-based RHEL-6:

Assertion 'clock_gettime(map_clock_id(clock_id), &ts) == 0' failed at systemd/src/basic/time-util.c:70, function now(). Aborting.

src/core/dbus-timer.c
src/core/timer.c
src/libsystemd/sd-event/sd-event.c

index bc121b83a27ac4143c864090e7481c067c8cd5bb..a0e61b023ecd1938970b4396f84ebe33a8c447f1 100644 (file)
@@ -156,7 +156,7 @@ static int property_get_next_elapse_monotonic(
                 usec_t a, b;
 
                 a = now(CLOCK_MONOTONIC);
-                b = now(CLOCK_BOOTTIME);
+                b = now(clock_boottime_or_monotonic());
 
                 if (t->next_elapse_monotonic_or_boottime + a > b)
                         x = t->next_elapse_monotonic_or_boottime + a - b;
index a51a67ea11cb69d0155fc39599eed01618a9715c..b286b714faca89a2693755beec13d2925994a497 100644 (file)
@@ -320,7 +320,7 @@ static usec_t monotonic_to_boottime(usec_t t) {
         if (t <= 0)
                 return 0;
 
-        a = now(CLOCK_BOOTTIME);
+        a = now(clock_boottime_or_monotonic());
         b = now(CLOCK_MONOTONIC);
 
         if (t + a > b)
index 9fd744768d5a7fffb46e23e00e50a7fcfe29ff8f..79b98c293c6ac14999595df961f368c550960ebc 100644 (file)
@@ -2527,7 +2527,7 @@ _public_ int sd_event_wait(sd_event *e, uint64_t timeout) {
         }
 
         dual_timestamp_get(&e->timestamp);
-        e->timestamp_boottime = now(CLOCK_BOOTTIME);
+        e->timestamp_boottime = now(clock_boottime_or_monotonic());
 
         for (i = 0; i < m; i++) {