I want to collect statistics about who is using a computer and for how much time. I can use the users command to see who is logged in but I want to know who is on the currently active VT. I don't care about people who's logged in through SSH or who leaves a download running in a locked session. I only care about who actually sits in front of the machine.
I need information on X and console sessions.
Getting the time of the last activity (moving the mouse, etc) would be also useful but I can live without it.
How can I do this?

wand then post process it a little? – Vitor Braga Jul 24 '11 at 20:08?xdm?instead of a time. – stribika Jul 24 '11 at 20:20