Keyboard Input

Does anyone know how do you determine the user idle time of STDIN in order to log the user out for being idle too long. I would like to write a c program to do this but I it is not clear upon how to determine idle time from keyboard input. I have found that the "who.c" source file uses the last access time of the tty. Is there no other way than access and mod times to see if the user is writing to STDIN and at what time?

Thanks in advance.

Chris

Please don't double post. See the forum rules.

I thought this would be the more appropriate forum since it is the programming forum. I did not know of its existence until now. There may be C programmers that do look at the scripting forum. You should have bitched at me earlier for posting in the wrong forum the first time. Someone must know the answer to this problem! Please Help!

The other forum was not precisely wrong, but double posting is against the rules. I'm not a moderator or anything, so don't pay any attention to me. Your question here is somewhat different than the first one anyway so maybe it's okay.

However, it's somewhat intriguing to think that there must be a better way, but the author of who.c choses not to use it. Could you elaborate on that train of thought, and maybe explain why you want to avoid using the tty access time?

Double post, continu here:

Thread closed.