Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!samsung!cs.utexas.edu!husc6!cmcl2!adm!news From: gaspar@stl-08sima.army.mil (Al Gaspar) Newsgroups: comp.unix.questions Subject: Re: How to find idle times. Message-ID: <24253@adm.BRL.MIL> Date: 22 Aug 90 12:06:11 GMT Sender: news@adm.BRL.MIL Lines: 22 > The 'w' command prints out the time each logged-in user has been idle. > How do I get at that infomat> ion myself, without grep'ing etc the output ? > The /etc/utmp file dosen't store this information, so it must come from > somewhere else (kmem ?). > Any pointer gratefully received. The way finger does it is to get the user's tty from /etc/utmp and then do a stat on /dev/userstty. The st_atime member of the stat struct obtained, being the last access time, will allow you to determine the idle time. I hope this helps. Cheers-- Al -- Al Gaspar USAMC SIMA, ATTN: AMXSI-TTC, Box 1578, St. Louis, MO 63188-1578 COMMERCIAL: (314) 331-4354 AUTOVON: 555-4354 uunet.uu.net!stl-08sima.army.mil!gaspar