AndrewMascolo / CountUpDownTimer

MIT License
28 stars 20 forks source link

Countdown example not working #21

Open goofee76 opened 6 years ago

goofee76 commented 6 years ago

I was looking for a countdown timer with pause for a project I'm doing. Unfortunately, the countdown timer example doesn't work as written. The call to ResumeTimer in every loop resets the timer so it can never advance. This adjustment seems to work. void ResumeTimer() // You can resume the timer if you ever stop it. { if (Paused) { Paused = false; time = _InternalClock(); } }

Also, I'm not sure why there's an if (Paused) inside the if (!Stop && !Paused) condition. It should never make it there, or is there something I'm missing?

AndrewMascolo commented 6 years ago

Those functions are not to be called repeatedly in the loop unless trigger by something that can pulse them, like a button or a switch.

Sent from my iPhone

On Aug 14, 2018, at 12:23 AM, goofee76 notifications@github.com wrote:

I was looking for a countdown timer with pause for a project I'm doing. Unfortunately, the countdown timer example doesn't work as written. The call to ResumeTimer in every loop resets the timer so it can never advance. This adjustment seems to work. void ResumeTimer() // You can resume the timer if you ever stop it. { if (Paused) { Paused = false; time = _InternalClock(); } }

Also, I'm not sure why there's an if (Paused) inside the if (!Stop && !Paused) condition. It should never make it there, or is there something I'm missing?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.