core: subscribe to /etc/localtime timezone changes and update timer elapsation accordingly
Fixes: #8233 This is our first real-life usecase for the new sd_event_add_inotify() calls we just added.
This commit is contained in:
@@ -819,6 +819,18 @@ static void timer_time_change(Unit *u) {
|
||||
timer_enter_waiting(t, false);
|
||||
}
|
||||
|
||||
static void timer_timezone_change(Unit *u) {
|
||||
Timer *t = TIMER(u);
|
||||
|
||||
assert(u);
|
||||
|
||||
if (t->state != TIMER_WAITING)
|
||||
return;
|
||||
|
||||
log_unit_debug(u, "Timezone change, recalculating next elapse.");
|
||||
timer_enter_waiting(t, false);
|
||||
}
|
||||
|
||||
static const char* const timer_base_table[_TIMER_BASE_MAX] = {
|
||||
[TIMER_ACTIVE] = "OnActiveSec",
|
||||
[TIMER_BOOT] = "OnBootSec",
|
||||
@@ -868,6 +880,7 @@ const UnitVTable timer_vtable = {
|
||||
|
||||
.reset_failed = timer_reset_failed,
|
||||
.time_change = timer_time_change,
|
||||
.timezone_change = timer_timezone_change,
|
||||
|
||||
.bus_vtable = bus_timer_vtable,
|
||||
.bus_set_property = bus_timer_set_property,
|
||||
|
||||
Reference in New Issue
Block a user