I am trying to use NSTimer to create a Stop-Watch style timer that increments every 0.1 seconds, but sometimes it works too fast.
Here is how I did it:
Timer =[NSTimer scheduledTimerWithTimeInterval: 0.1 target:self selector:@selector(updateTimeLabel) userInfo:nil repeats: YES];
and then:
-(void)updateTimeLabel { maxTime=maxTime+0.1; timerLabel.text =[NSString stringWithFormat:@"%.1f Seconds",maxTime]; }
This will display the timer value in the shortcut, and later I can use maxTime as the timer stop time ...
The problem is that it works very inaccurately.
Is there a way in which I can make sure that NSTimer fires strictly every 0.1 seconds for sure? I know that NSTimer is not accurate, and I ask you to configure it to be accurate.
thanks
source share