Pomodoro Clock Timing Issues (Tests #Timer 10, 12, 14)

Hey guys! Looking to get some input on why my timer might not being working correctly. Scoured the forums but everything I find is from a couple of years ago and hasn’t been close to how I have my code. Any help is appreciated as I can’t seem to figure out why my code can’t past the test even when visually everything works.

I am assuming that the timer might be slightly off of what it should be but I have tried different interval times to no avail (lower and higher).

EDIT: So I switched the time that the interval was behaving on from the 30ms checking for the date to be greater then the nextDate to using the displayTime directly. This works the same I just can run through the testing at much faster rate. Still having the issues with 00:00 “not being reached” even though it is. I change see the timer hit 00:00 for one full second and also can see that prev is hitting 0. As far as test 10 is concerned though I really am not sure how to go about this issue.

To be more specific:

Frequently the problem is not displaying 00:00 for 1 second. You have a test like

prev <= 0

When prev becomes 0, you immediately stop and switch. You can change it to

prev < 0

and see what happens.

Also, you’re creating Date objects to check the time lapse. I used a int counter timeLeft and decrement it every second.

I have tried this but thanks for the suggestion, I do appreciate your time.

For some reason it worked before. Just randomly the code started not passing those tests and I didn’t catch at what point in writing the code did it stop passing them. I noticed that the solution fCC gives as an example uses a “accurateInterval” function so that might be something I try out. I previously tried how you had it but I ran into some different issues.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.