diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-11-09 17:30:58 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-11-09 17:30:58 +0100 |
commit | e8b4b135e5940a76d66af013b69234bc5d2db6a4 (patch) | |
tree | 9ca90e7df79fea9bb94d20656acbcba2bedcf4b8 /src/core | |
parent | dfa1f158749161ca671e8aa589b62019ad9c4e2a (diff) | |
parent | c1d9ba9978561b087760bc3b77b1f330bb22e33f (diff) |
Merge pull request #1807 from michich/boot-timer
core/timer: in containers OnBootSec should count from container startup
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/timer.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/core/timer.c b/src/core/timer.c index cc2afedabf..c9dc97d4fb 100644 --- a/src/core/timer.c +++ b/src/core/timer.c @@ -34,6 +34,7 @@ #include "unit-name.h" #include "unit.h" #include "user-util.h" +#include "virt.h" static const UnitActiveState state_translation_table[_TIMER_STATE_MAX] = { [TIMER_DEAD] = UNIT_INACTIVE, @@ -359,10 +360,14 @@ static void timer_enter_waiting(Timer *t, bool initial) { break; case TIMER_BOOT: - /* CLOCK_MONOTONIC equals the uptime on Linux */ - base = 0; - break; - + if (detect_container() <= 0) { + /* CLOCK_MONOTONIC equals the uptime on Linux */ + base = 0; + break; + } + /* In a container we don't want to include the time the host + * was already up when the container started, so count from + * our own startup. Fall through. */ case TIMER_STARTUP: base = UNIT(t)->manager->userspace_timestamp.monotonic; break; |