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?
A:
Have a look here http://stackoverflow.com/questions/3519562/how-do-i-write-a-timer-in-objective-c it appears that NSTimer is not an high resolution timer
rano
2010-08-20 09:22:10
yeah but i need it to fire a selector six times a second. and its not.
marty
2010-08-20 09:30:29
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
2010-08-20 09:53:24
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
2010-08-20 19:00:26
you shall post some code
rano
2010-08-20 19:09:01
A:
Maybe you want to use ticks instead?
_animationTimer = NSTimer.CreateRepeatingTimer(TimeSpan.FromTicks(Convert.ToInt64(AnimationInterval * 10000000l)), MainLoop);
Fabian Fritz
2010-08-20 09:27:57