Using OS time
tireseas at onetel.com
Fri Jun 20 19:04:06 CEST 2003
Hmmm - I'm not at all familiar with signal.alarm() nor how to use it Skip.
After googling for info on this, I found this at
Listing 5. Using Alarm Signal
def alarm_handler(signal, frame):
signal.alarm(5) # generate SIGALRM after 5 secs
n = 0
n = n+1
This seems to be the closest to what you describe. I'll play around with this
and see what it does.
I suppose a lengthier but more n00bie friendly way of doing this 'countdown'
would be to countdown from a given number (e.g. 60) and import time.sleep to
sleep for 1 second at each new iteration in the for loop. I think this would
do the same thing.
Anyway, I'll fool around with both of these options and see which one I find
easier to work with.
On Friday 20 Jun 2003 17:07, Skip Montanaro wrote:
> How about signal.alarm()?
> Arrange for SIGALRM to arrive after the given number of seconds.
> You will obviously have to have a signal handler set up to recover from the
> signal. You'll have to experiment to see if the signal will terminate the
> call to raw_input() (or whatever you're using to gather user input).
|| Reg. Linux User: 313143 ||
Sign the Petition:
More information about the Python-list