X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Ftimer.c;h=dc0f289c7afafc943e8d742ac88d4f1663a15fff;hb=ac45dec934b0932d03fbd498a3c6e8e90a01813f;hp=6f2deda21f60f97fd3ddf9c7e00ffb1d9153ac71;hpb=359efc59fdc05e0b9b758b46cf6fb4cfecadbf64;p=elogind.git diff --git a/src/core/timer.c b/src/core/timer.c index 6f2deda21..dc0f289c7 100644 --- a/src/core/timer.c +++ b/src/core/timer.c @@ -46,8 +46,8 @@ static void timer_init(Unit *u) { assert(u); assert(u->load_state == UNIT_STUB); - t->next_elapse_monotonic_or_boottime = (usec_t) -1; - t->next_elapse_realtime = (usec_t) -1; + t->next_elapse_monotonic_or_boottime = USEC_INFINITY; + t->next_elapse_realtime = USEC_INFINITY; t->accuracy_usec = u->manager->default_timer_accuracy_usec; } @@ -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); @@ -131,7 +141,7 @@ static int timer_setup_persistent(Timer *t) { e = getenv("XDG_DATA_HOME"); if (e) - t->stamp_path = strjoin(e, "/systemd/timers/", UNIT(t)->id, NULL); + t->stamp_path = strjoin(e, "/systemd/timers/stamp-", UNIT(t)->id, NULL); else { _cleanup_free_ char *h = NULL;