laziness, impatience, and hubris | |
PerlMonks |
Re: Computer User Timerby cbro (Pilgrim) |
on Jun 12, 2003 at 16:16 UTC ( [id://265402]=note: print w/replies, xml ) | Need Help?? |
I suggest Time::HiRes and the setitimer/getitimer functions. For docs go here. You could set the timer using setitimer. Then to display a a timer to the user, use getitimer and keep updating a formatted line via some method like 'formline' (which I use personally for displaying progress bars). Eventually, setitimer is going to send a SIG_ALARM, which you can catch in a subroutine that implements whichever method of 'stopping' the user from continuing to use the PC that you decide to use (e.g. I don't know what exactly to do to prevent access to the PC when the timer expires). HTH, Chris
In Section
Seekers of Perl Wisdom
|
|