Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sometimes countdown timer stalls and skips seconds #51

Open
michaelkirk opened this issue Jun 2, 2015 · 4 comments
Open

sometimes countdown timer stalls and skips seconds #51

michaelkirk opened this issue Jun 2, 2015 · 4 comments

Comments

@michaelkirk
Copy link
Member

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
Copy link
Contributor

jmoody commented Jul 15, 2015

Reproduced!

@jmoody
Copy link
Contributor

jmoody commented Jul 15, 2015

@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
Copy link
Contributor

jmoody commented Sep 1, 2015

@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
Copy link
Contributor

jmoody commented Sep 1, 2015

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.

  • Try setNeedsDisplay() so the label is redrawn. Did not help.
  • Try updating the text in an animation block.
  • Try on a device.
  • Try with opaque background.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants