Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Deep recursion in Tk repeat

by benn (Vicar)
on Sep 01, 2003 at 16:19 UTC ( [id://288158]=note: print w/replies, xml ) Need Help??


in reply to Deep recursion in Tk repeat

Rather than attempting to guess the refresh rate beforehand, you could work it out at runtime, then use this to drive your main loop - something roughly like...(untested, obviously)
use Time::Hires; $avg_num=10; # or whatever $s=time(); #Time::Hires floating-point drop-in $taxis->taxis() for (0..$avg_num); $refresh = (time()-$s)/$avg_num; $refresh = $sensible if ($refresh < $sensible;} while(1) { $start=time(); $taxis->taxis(); do { DoOneEvent( $running ? DONT_WAIT : ALL_EVENTS ); } until (time()-$start > $refresh); }
Cheers, Ben.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://288158]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2025-02-08 21:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which URL do you most often use to access this site?












    Results (95 votes). Check out past polls.