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

Timer skips seconds #90

Closed
karbassi opened this issue Jul 11, 2020 · 3 comments · Fixed by #94
Closed

Timer skips seconds #90

karbassi opened this issue Jul 11, 2020 · 3 comments · Fixed by #94
Assignees
Labels
Milestone

Comments

@karbassi
Copy link
Collaborator

Describe the bug
The timer skips seconds from time to time (pun intended). For example, it may go from 53 to 51 without seeing 52.

To Reproduce
Steps to reproduce the behavior:

  1. Set timer to 1 minute
  2. Watch it count down and observe it skipping numbers

Expected behavior
It shouldn't skip numbers.

Desktop (please complete the following information):

  • OS version: macOS 10.15.5
  • Version: 1.5.4
@karbassi karbassi self-assigned this Jul 11, 2020
@karbassi karbassi added the bug label Jul 11, 2020
@karbassi karbassi added this to the Backlog milestone Jul 11, 2020
@luckman212
Copy link

luckman212 commented Jul 12, 2020

I noticed this too - I was poking around in the source to try to figure out why this was happening. Something related to Foundation.Timer.scheduledTimer(timeInterval maybe?

@robinstewart
Copy link
Contributor

When I was making the app more energy efficient, I made sure that the UI is only updated once per second. I think what may be happening is that in the unusual case where you happen to start the countdown very close to the seconds boundary, you could get an update at, say 8.99 seconds and then at 8.01 seconds, which would both show as "8".

Note the Foundation repeating timers don't "drift" -- you don't get 8.99 then 7.95 then 6.91, then 5.86. It's just an issue of variance around the boundary where you might get 8.99 then 8.01 then 6.99 then 6.01.

This implies the fix is to make sure the repeating timer starts safely away from a boundary -- to make sure you get updates at for example 9.09, 8.11, 7.08, 6.10, 5.09 (the variance doesn't affect the significant digit).

@luckman212
Copy link

Fix #94 looks good.

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