[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Idle time

> w reports that my machine has been up for 13 hours yet my console has been
> idle for 29 hours.  Note that I have not yet logged in via the console.

Hmm, are you sure this is not just more right than you were expecting?
As is traditional in Unix, idle time is determined by look at the atime of
the device file (/dev/console in this case), and that time is updated
whenever a character is read from the device.  It is only when a character
is read from /dev/console that the atime gets updated, and then this update
is stored in the underlying file's inode on disk (which unix also does).
So it might in fact just be the case that 29 hours ago was the last time a
character was read from /dev/console.

A quick perusla of linux sources does not quite make it clear to me
when/how linux sets the atime of a terminal.

Reply to: