tree-wide: fall back to now(CLOCK_MONOTONIC) if CLOCK_BOOTTIME unsupported (#3037)
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.
This commit is contained in:
committed by
Zbigniew Jędrzejewski-Szmek
parent
746af6e0b5
commit
6f7202cfd5
@@ -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;
|
||||
|
||||
+1
-1
@@ -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)
|
||||
|
||||
@@ -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++) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user