Alternative to NSTimer
DoG Wrote:First of all, NSTimer doesn't misfire, so please stop spreading nonsense.
Yes, it does. If your code has not completed by the next time the timer is scheduled to fire, it misfires.
From Apples documentation for NSTimer:
Quote:A repeating timer reschedules itself based on the scheduled firing time, not the actual firing time. For example, if a timer is scheduled to fire at a particular time and every 5 seconds after that, the scheduled firing time will always fall on the original 5 second time intervals, even if the actual firing time gets delayed. If the firing time is delayed so far that it passes one or more of the scheduled firing times, the timer is fired only once for that time period; the timer is then rescheduled, after firing, for the next scheduled firing time in the future.
In other words, a timer can misfire. A misfire is simply skipping a fire.
I've seen this happen a lot on the iPhone, especially when doing some rapid prototyping. Before optimising the drawing code, if it takes close to 16.6 ms (which is the period for 60fps), the timer regularly fires with 33.3 ms intervals (double 16ms, as one fire has been skipped).
This is why mainly people oversample (trigger the timer at a much higher rate than required for 60fps), perhaps without realising it.
|Messages In This Thread|
Alternative to NSTimer - mpatric - Jul 14, 2009 08:12 AM
Possibly Related Threads...
|NSTimer fine, CADisplayLink having some issues||monteboyd||5||7,654||
Aug 31, 2010 07:05 PM
Last Post: Skorche
Sep 24, 2009 07:35 PM
Last Post: jeonghyunhan
|Using an NSTimer to progressively draw a view||StevenD||4||3,742||
May 14, 2009 07:57 AM
Last Post: StevenD
|OpenGL render loop - NSTimer vs rendering thread||smallstepforman||27||20,745||
Feb 2, 2009 10:22 AM
Last Post: ThemsAllTook
|Alternative Input/Control Ideas||chrisco||8||3,901||
Aug 6, 2008 03:21 PM
Last Post: bruss14