core: don't drop timer expired but not yet processed when system date is changed
authorInsun <iplayinsun@gmail.com>
Sun, 28 Oct 2018 12:26:13 +0000 (21:26 +0900)
committerLennart Poettering <lennart@poettering.net>
Tue, 30 Oct 2018 14:38:45 +0000 (15:38 +0100)
commitfee04d7f3ab810e99b97535ca5fda2f9517acda9
tree32b447a1a2d1bf29f07549eb46a40fa236848799
parentc1b785bb66e352abcd7439187827f860639053f5
core: don't drop timer expired but not yet processed when system date is changed

There is difference between time set by the user and real elapsed time because of accuracy feature.
If you change the system date(or time) between these times, the timer drops.

You can easily reproduce it with the following command.
-----------------------------------------------------------
$ systemd-run --on-active=3s ls; sleep 3; date -s "`date`"
-----------------------------------------------------------

In the following command, the problem is rarely reproduced. But it exists.
---------------------------------------------------------------------------------------------
$ systemd-run --on-active=3s --timer-property=AccuracySec=1us ls ; sleep 1; date -s "`date`"
---------------------------------------------------------------------------------------------

Note : Global AccuracySec value.
----------------------------------------------------------------------
$ cat /etc/systemd/system.conf
DefaultTimerAccuracySec=1min
----------------------------------------------------------------------
src/core/timer.c