Compare commits

...

2 Commits

Author SHA1 Message Date
Florian Schmaus c2cffd1e80
Merge d7e58758a6 into 52b0351a15 2024-11-20 10:25:34 +00:00
Florian Schmaus d7e58758a6 logind: let system-wide idle begin at the time logind was initialized
Initialize the start of the system-wide idle time with the time logind was
initialized and not with the start of the Unix epoch. This means that systemd
will not repport a unreasonable long idle time (around 54 years at the time of
writing this), especially at in the early boot, while no login manager session,
e.g,. gdm, had a chance to provide a more accurate start of the idle period.

Fixes #35163
2024-11-19 17:06:55 +01:00
3 changed files with 8 additions and 0 deletions

View File

@ -411,6 +411,10 @@ int manager_get_idle_hint(Manager *m, dual_timestamp *t) {
assert(m); assert(m);
/* Initialize the baseline timestamp with the time the manager got initialized to avoid reporting
* unreasonable large idle periods starting with the Unix epoch. */
ts = m->init_ts;
idle_hint = !manager_is_inhibited(m, INHIBIT_IDLE, /* block= */ true, t, false, false, 0, NULL); idle_hint = !manager_is_inhibited(m, INHIBIT_IDLE, /* block= */ true, t, false, false, 0, NULL);
HASHMAP_FOREACH(s, m->sessions) { HASHMAP_FOREACH(s, m->sessions) {

View File

@ -100,6 +100,8 @@ static int manager_new(Manager **ret) {
(void) sd_event_set_watchdog(m->event, true); (void) sd_event_set_watchdog(m->event, true);
dual_timestamp_now(&m->init_ts);
manager_reset_config(m); manager_reset_config(m);
*ret = TAKE_PTR(m); *ret = TAKE_PTR(m);

View File

@ -145,6 +145,8 @@ struct Manager {
struct stat efi_loader_entry_one_shot_stat; struct stat efi_loader_entry_one_shot_stat;
CalendarSpec *maintenance_time; CalendarSpec *maintenance_time;
dual_timestamp init_ts;
}; };
void manager_reset_config(Manager *m); void manager_reset_config(Manager *m);