From: Michael Tomer Date: 2009-09-09T01:38:33+09:00 Subject: Time based loop limiting I'm trying to write a loop that will only run a certain number of times per second. For instance, in Ruby-Processing, you would use "frame_rate(30)" to make the main loop execute no more than 30 evenly spaced frames per second. How might I go about doing something like that? I could try calling sleep with a float that represents the difference between the next time I want the loop to run and the current time. That seems clunky, though. I also thought about using the Observer pattern to have a timer alert the simulation each time it should update. That also seems wrong. I feel like I must be overlooking something simple. Any ideas? -- Posted via http://www.ruby-forum.com/.