CountUpDownTimer icon indicating copy to clipboard operation
CountUpDownTimer copied to clipboard

Countdown example not working

Open goofee76 opened this issue 7 years ago • 1 comments

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?

goofee76 avatar Aug 14 '18 04:08 goofee76

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.

  • Andrew

Sent from my iPhone

On Aug 14, 2018, at 12:23 AM, goofee76 [email protected] 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.

AndrewMascolo avatar Aug 14 '18 11:08 AndrewMascolo