I am trying to find a reliable solution with regards to measuring time in ios.
I’d like to show the passing of time with 1 sec precision. Exactly Like a stopwatch built in ios, but only seconds.
So far every solution I found, seems clunky, since it either uses polling with help of NStimer
or some love level C stuff.
The problem I have, is that “I” need to ask the system every time, what’s the time. But if I should rely on NStimer which is nondeterminate, then my measurement is very unreliable.
Isn’t there a delegate method called from the system that would update my time?
I guess If I enhanced the resolution of polling to 1 ns, it would be ok. But how should I implement it using low level C?
I am trying to find a reliable solution with regards to measuring time in
Share
I’m not sure what you are aiming for. I can’t figure out if you want a good way to query a high-resolution time, or if you want the system to call you back.
If the former, this is what I use for hi-res timer.
If the latter, then you can never get a guaranteed callback timer. Probably the most consistent timer callback will be to hook into CADisplayLink, but then you may not get that consistently if your graphics methods take too long.
You can try the system timers, but you won’t get much guarantee there either.