Skip to content

WakeSystem= and other timer fixes#6176

Merged
keszybz merged 6 commits intosystemd:masterfrom
poettering:timer-boottime-monotonic
Jun 23, 2017
Merged

WakeSystem= and other timer fixes#6176
keszybz merged 6 commits intosystemd:masterfrom
poettering:timer-boottime-monotonic

Conversation

@poettering
Copy link
Member

A fix for #5629 and a number of other time related cleanups.

…signed()

Quite often we just want to subtract two normal usec_t values, hence
provide an implementation for that.
…en clocks

We use that quite often, let's implement one clean version of it.
…_clock()

Let's use the generic clock shifting logic here.
This reworks timer_enter_waiting() in a couple of ways in order to clean
it up a bit and fix systemd#5629.

Most importantly, we previously we initialized ts_monotonic to either
the current time in CLOCK_MONOTONIC or in CLOCK_BOOTTIME, depending on
t->wake_system. Then given specific conditions we'd use this time as
base for our timers. And afterwards, if t->wake_system was on we'd
convetr the resulting value from CLOCK_MONOTONIC to CLOCK_BOOTTIME again
— which of course is wrong since we already were in CLOCK_BOOTTIME! This
fixes this logic, by using a triple timestamp so that we always have the
right base around, and initially only calculate in CLOCK_MONOTONIC and
only convert as last step.

Conversion between the clocks is now done with the generic
usec_shift_clock(), and additions via usec_add() making these
calculations a bit safer.

Fixes: systemd#5629
…time

When debugging time issues its kinda handy to have an easy way to query
the three clocks, hence let's just output them at the beginning of
test-time.
@keszybz
Copy link
Member

keszybz commented Jun 23, 2017

Commit 5/6 is a bit tricky, but looks correct. Looks all good.

@keszybz keszybz merged commit 9fe4a3d into systemd:master Jun 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants