On 8/18/08, Berco Beute <[EMAIL PROTECTED]> wrote: > > I'm setting up an interval that calls the function 'update' every 5 > seconds. But sometimes I have to reschedule the interval. To do so I > first unschedule the old interval and reschedule the interval as > follows: > > ================================== > pyglet.clock.unschedule(update) > pyglet.clock.schedule_interval(update, 5) > > ================================== > > The first time the interval runs the correct interval of 5 seconds is > used, the second time the same interval is scheduled the timing seems > to be around 2 seconds. How could that be?
The problem is because the pyglet clock schedules functions from the last known time value, not the current time. This used to be a good thing, because the clock would tick regularly and quickly, so items that were scheduled near each other would be guaranteed to be scheduled into the same slot. The new app loop sleeps long amounts of time, though, causing the last known time to diverge from the current time noticeably (as you've noticed!). I've put in what I think is a good fix (a compromise between the two goals, using a heuristic of 200ms for judging when the clock is ticking "slowly"). I can't commit right now (some gateway error between here and googlecode), but I'll try again in the morning (AEST) and let you know when it's in trunk and pyglet-1.1-maintenance. Alex. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pyglet-users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pyglet-users?hl=en -~----------~----~----~----~------~----~------~--~---
