jackpine / biketag-ios

http://biketag.jackpine.me
1 stars 1 forks source link

sometimes countdown timer stalls and skips seconds #51

Open michaelkirk opened 9 years ago

michaelkirk commented 9 years ago

Given I've guess the new spot Then I see the countdown timer But sometimes it will say (e.g.) 23:02 for 2 seconds And then hop to (e.g.) 23:00.

So, the actual time keeping is correct, but the display is not reliably updated.

jmoody commented 9 years ago

Reproduced!

jmoody commented 9 years ago

@michaelkirk

I am not sure what the priority of this is.

NSTimer is not meant to be super accurate.

You could try replacing the NSTimer with dispatch_source_create and dispatch_source_set_event_handler - Official Docs.

I would also replace NSDate with CFAbsoluteTimeGetCurrent().

jmoody commented 9 years ago

@michaelkirk

Does this also happen on physical devices? I can't build for devices without credentials.

Looking at this a little more, the delay might be caused by the clear background of the UILabel - view cannot be drawn fast enough.

jmoody commented 9 years ago

I tried the CFAbsoluteTimeGetCurrent() and dispatch_source_set_event_handler.

It did not really make a difference. Although the CFAbsolutTimeGetCurrent seems to work a little better with NSTimer.