On Mon, 23.07.12 00:17, Zbigniew Jędrzejewski-Szmek (zbys...@in.waw.pl) wrote:
> Hi, > > after reading the code, the following seems like a reasonable change > of semantics. Please have a look. > > ----8<----- > > Before, after the timeout, a session would be timestamped as idle > since 'last activity + idle timeout'. Now, it is timestamped as idle > since 'last activity'. > > Before, after all sessions were idle, the seat would be marked with as > idle with the timestamp of the oldest idle session. Now it is > marked with the timestamp of the youngest idle session. > > Iow., the timeout to idle is not modified, only the timestamp that is > reported. Both changes seem to me to be closer to natural understanding of > when idleness started: at last activity. Of course we only can tell after > waiting through the suitable timeout. Looks good to me! Please commit (and keep this commit text in, of course...). Thanks! > > --- > > src/login/logind-seat.c | 2 +- > src/login/logind-session.c | 6 ++---- > 2 files changed, 3 insertions(+), 5 deletions(-) > > diff --git a/src/login/logind-seat.c b/src/login/logind-seat.c > index 0457121..11e41b5 100644 > --- a/src/login/logind-seat.c > +++ b/src/login/logind-seat.c > @@ -460,7 +460,7 @@ int seat_get_idle_hint(Seat *s, dual_timestamp *t) { > > if (!ih) { > if (!idle_hint) { > - if (k.monotonic < ts.monotonic) > + if (k.monotonic > ts.monotonic) > ts = k; > } else { > idle_hint = false; > diff --git a/src/login/logind-session.c b/src/login/logind-session.c > index 819596d..6d40450 100644 > --- a/src/login/logind-session.c > +++ b/src/login/logind-session.c > @@ -731,7 +731,6 @@ int session_get_idle_hint(Session *s, dual_timestamp *t) { > char *p; > struct stat st; > usec_t u, n; > - bool b; > int k; > > assert(s); > @@ -766,12 +765,11 @@ int session_get_idle_hint(Session *s, dual_timestamp > *t) { > > u = timespec_load(&st.st_atim); > n = now(CLOCK_REALTIME); > - b = u + IDLE_THRESHOLD_USEC < n; > > if (t) > - dual_timestamp_from_realtime(t, u + b*IDLE_THRESHOLD_USEC); > + dual_timestamp_from_realtime(t, u); > > - return b; > + return u + IDLE_THRESHOLD_USEC < n; > > dont_know: > if (t) Lennart -- Lennart Poettering - Red Hat, Inc. _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel