Glitch with Timer

Backstory so you know what this Project is for:
People in my English 9 Honours Class (or any of my classes, in general) keep asking for my Chromebook Charger, and for 2 months, since school started, I've been just giving them my Chromebook Charger for free, and they think they can just use it without any consequences. So I decided to capitalize on this opportunity. I decided to charge my friends 10 cents every 2 1/2 minutes they use my Charger. That way, not only would they think that they could use my Charger for the entire class time, they will want to give it back to me so that they don't have to pay that much.

ANYWAYS, enough backstory, here's the glitch.
Basically, if I run the project in a single tab, the timer has no problem running and stuff. However, if I leave that tab to do other stuff (I leave that tab to run in the background), the timer glitches out and so does the project. The timer continues but the project doesn't...

You can use time in milliseconds instead. Just store the current time in milliseconds when you start the project, (optionally save the time to a file), then when you want to stop the timer, just store the current time in milliseconds in a different variable and then just find the difference between (end) - (start). This will not rely on a timer, instead it relies on the current time.

Oh, and after that, you convert the resulting milliseconds to minutes / seconds.

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