summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorTobias Geerinckx-Rice <tobias.geerinckx.rice@gmail.com>2014-08-04 22:15:52 +0200
committerLennart Poettering <lennart@poettering.net>2014-08-14 01:49:40 +0200
commit19f8d037833f2426f0ea6b06279d669ed69fcfd1 (patch)
treebb66c486608abb2f8be5b66da2e6de0d1821fd2b /src/core
parenteb7040ec50fbfe5aad9eaf305bd442a4a235abaa (diff)
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.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/timer.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/core/timer.c b/src/core/timer.c
index a5a33a6e6f..dc0f289c7a 100644
--- a/src/core/timer.c
+++ b/src/core/timer.c
@@ -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);