Skip to content

OnActiveSec calculated against wrong clock if WakeSystem is set #5629

@benzea

Description

@benzea

Submission type

  • Bug report
  • Request for enhancement (RFE)

systemd version the issue has been seen with

Version: systemd 231-14.fc25

Used distribution

Fedora

In case of bug report: Expected behaviour you didn't see

In case of bug report: Unexpected behaviour you saw

In case of bug report: Steps to reproduce the problem

Registering a task like this works fine:

systemd-run --description "Wakeup in 10 seconds" --on-active 10 true

However, if one sets WakeSystem, then the wrong clock is used (the calculation seems to be missing suspend times and the timer will be run much later than expected):

systemd-run --description "Wakeup in 10 seconds" --on-active 10  --timer-property "WakeSystem=true" true

The result of the above is (first timer run-r860ff4280aa8402ba858227f443d31a9.timer, second timer run-r00fff73ce70a42c2940ea594fd82df7a.timer):

Fri 2017-03-24 14:04:48 CET   9s left        n/a                          n/a          run-r860ff4280aa8402ba858227f443d31a9.timer run-r860ff4280aa8402ba858227f443d31a9.service
Sun 2017-03-26 12:24:11 CEST  1 day 21h left n/a                          n/a          run-r00fff73ce70a42c2940ea594fd82df7a.timer run-r00fff73ce70a42c2940ea594fd82df7a.service

The time difference is the difference in hours between the MONOTONIC and BOOTTIME clocks in this case was:

python3 -c 'import time; CLOCK_BOOTTIME=7; print((time.clock_gettime(CLOCK_BOOTTIME)-time.clock_gettime(time.CLOCK_MONOTONIC))/60/60)'
45.323057009440284

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐛Programming errors, that need preferential fixingpid1

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions