timer: order OnCalendar units after timer-sync.target if DefaultDependencies=no
Avoids triggering timers prematurely on systems with significantly inaccurate clocks, or some embedded platforms that lack one entirely.
This commit is contained in:
committed by
Lennart Poettering
parent
eb7040ec50
commit
19f8d03783
@@ -95,6 +95,7 @@ static int timer_verify(Timer *t) {
|
||||
|
||||
static int timer_add_default_dependencies(Timer *t) {
|
||||
int r;
|
||||
TimerValue *v;
|
||||
|
||||
assert(t);
|
||||
|
||||
@@ -106,6 +107,15 @@ static int timer_add_default_dependencies(Timer *t) {
|
||||
r = unit_add_two_dependencies_by_name(UNIT(t), UNIT_AFTER, UNIT_REQUIRES, SPECIAL_SYSINIT_TARGET, NULL, true);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
LIST_FOREACH(value, v, t->values) {
|
||||
if (v->base == TIMER_CALENDAR) {
|
||||
r = unit_add_dependency_by_name(UNIT(t), UNIT_AFTER, SPECIAL_TIME_SYNC_TARGET, NULL, true);
|
||||
if (r < 0)
|
||||
return r;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return unit_add_two_dependencies_by_name(UNIT(t), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_SHUTDOWN_TARGET, NULL, true);
|
||||
|
||||
Reference in New Issue
Block a user