RichardH has asked for the wisdom of the Perl Monks concerning the following question:
Now this process works just fine, but it eats up a lot of cpu cycles. I've thought about making it a cron job that is called every five minutes, but that would add some complexity, since the process has to know how often it failed when it is checking out some stats every five minutes. Is there a more efficient way to do this? Thanks!$lastGood = time(); while( 1==1) { #print "."; #print time(), "\t", $lastGood, "\n"; if ((time() - $lastGood) > 300) #if it has been 5 minutes s +ince the last check, check again { #do something $lastGood = time(); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Making a program stop executing for five minutes
by davorg (Chancellor) on Feb 20, 2001 at 20:41 UTC | |
|
(redmist) Re: Making a program stop executing for five minutes
by redmist (Deacon) on Feb 20, 2001 at 22:21 UTC | |
|
Re: Making a program stop executing for five minutes
by dws (Chancellor) on Feb 20, 2001 at 22:27 UTC | |
|
Re: Making a program stop executing for five minutes
by zigster (Hermit) on Feb 20, 2001 at 20:43 UTC | |
|
Re: Making a program stop executing for five minutes
by TheoPetersen (Priest) on Feb 20, 2001 at 20:42 UTC | |
|
Re: Making a program stop executing for five minutes
by McD (Chaplain) on Feb 21, 2001 at 00:23 UTC | |
|
Re: Making a program stop executing for five minutes
by ChOas (Curate) on Feb 20, 2001 at 20:42 UTC |