Is ElapsedTime in-app or system wide?

If I start a project and measure ElapsedTime one second later, it will be 1.

If I immediately switch to another app for an hour, and then come back to the still-running project, and let a second pass, will ElapsedTime be 2 or will it be an hour plus 2?

1 Like

from what i tested it pauses the count but it takes around 3 seconds for the pause to take effect

so if you came back after an hour it would say 4 seconds

1 Like

From my recollection @skar is correct

Elapsed time is the accumulated frame deltas, and Codea pauses when becoming inactive, so the deltas stop accumulating

@sim - wouldn’t it be better if the option of reading the system clock and calculating the time difference directly as a measure of elapsed time ? Or does it vary from pad generation with respect to the core and system speed.?

That might be better, though I guess it depends how it is being used. I think not counting the paused state can be helpful for some cases, and not for others. We should probably consider adding a now() function to get the current time — then you can compute the difference yourself to get the elapsed time even if you close the application (useful for making a stopwatch, for example)

@sim - sounds like a good way forward and, by the sound of it, simple to use. I’m sure @dave1707 wrote and published something in the past - if so may be a good idea to add it to a Codea library.