I want to have something happen about 6 times a second, consistently and accurately. I tried setting an NSTimer, but it had very low accuracy and consistency. What would you recommend?
Asked
Active
Viewed 691 times
2 Answers
0
Have a look here How Do I write a Timer in Objective-C? it appears that NSTimer is not an high resolution timer
-
yeah but i need it to fire a selector six times a second. and its not. – marty Aug 20 '10 at 09:30
-
you can use those methods to compute a high resolution time difference and after the delta of time is higher of your threshold you can fire your action – rano Aug 20 '10 at 09:53
-
well what im actually trying to do is make a strobe light. ive seen other apps do it and just wanted to try it. i duno why but the method that turns the light on and off must be too slow or something because it's very unreliable when i strobe it. i say to call it every .5 seconds and sometimes its on longer than others, sometimes it takes a while to get going, etc. – marty Aug 20 '10 at 19:00
0
Maybe you want to use ticks instead?
_animationTimer = NSTimer.CreateRepeatingTimer(TimeSpan.FromTicks(Convert.ToInt64(AnimationInterval * 10000000l)), MainLoop);

Fabian Fritz
- 390
- 3
- 14