From 0bf1d0ff049dd257dc5b6efc6b3f5864dc8bee6e Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Thu, 20 Oct 2022 14:01:09 +0100 Subject: Revert "Fix issue with system time set back (#24131)" This fix unfortunately introduced a much worse regression that is affecting many users, so let's revert it for now and rework it in the next release. This reverts commit 5ded3917a161d87984d74d70b5eb2a254e54b44e. Fixes https://github.com/systemd/systemd/issues/24984 --- src/core/timer.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'src/core/timer.c') diff --git a/src/core/timer.c b/src/core/timer.c index cfc20fb613..8bd430b931 100644 --- a/src/core/timer.c +++ b/src/core/timer.c @@ -394,18 +394,19 @@ static void timer_enter_waiting(Timer *t, bool time_change) { if (v->base == TIMER_CALENDAR) { usec_t b, rebased; - /* Update last_trigger to 'now' in case the system time changes, so that - * next_elapse is not stuck with a future date. */ - if (time_change) - b = ts.realtime; - /* If we know the last time this was triggered, schedule the job based relative - * to that. If we don't, just start from the activation time. */ - else if (t->last_trigger.realtime > 0) + /* If we know the last time this was + * triggered, schedule the job based relative + * to that. If we don't, just start from + * the activation time. */ + + if (t->last_trigger.realtime > 0) b = t->last_trigger.realtime; - else if (state_translation_table[t->state] == UNIT_ACTIVE) - b = UNIT(t)->inactive_exit_timestamp.realtime; - else - b = ts.realtime; + else { + if (state_translation_table[t->state] == UNIT_ACTIVE) + b = UNIT(t)->inactive_exit_timestamp.realtime; + else + b = ts.realtime; + } r = calendar_spec_next_usec(v->calendar_spec, b, &v->next_elapse); if (r < 0) -- cgit v1.2.1