summaryrefslogtreecommitdiff
path: root/src/core/timer.c
diff options
context:
space:
mode:
authorLuca Boccassi <bluca@debian.org>2022-10-20 14:01:09 +0100
committerLuca Boccassi <bluca@debian.org>2022-10-20 14:01:09 +0100
commit0bf1d0ff049dd257dc5b6efc6b3f5864dc8bee6e (patch)
tree1d440a0e73ba9085b5e39b2d3e51838d2f10570d /src/core/timer.c
parent40c05a34595ed769ce676206f3c5de874f9a9234 (diff)
downloadsystemd-0bf1d0ff049dd257dc5b6efc6b3f5864dc8bee6e.tar.gz
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
Diffstat (limited to 'src/core/timer.c')
-rw-r--r--src/core/timer.c23
1 files changed, 12 insertions, 11 deletions
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)