[Tutor] timeout
Alan Gauld
alan.gauld at freenet.co.uk
Mon Jan 16 19:17:15 CET 2006
> how can I break a loop after a certain amount of time has passed?
> with timeout of 60sec:
I assume you want the loop to do somerthing until the timeout?
If so then the logic is:
timeout = now() + 60
while now() < timeout:
do something.
Using the time module you can easily calculate timeout and now.
It gets trickier with small values - if you wanted 60ms say, but at
the seconds level it works ok.
HTH,
Alan G
Author of the learn to program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld
More information about the Tutor
mailing list