Issue About Timer

I compared the stopwatch that I made and the results are every 1 minute a difference of 2-4 seconds from the phone's default stopwatch, how to fix it? Please help :pray:t2: :pray:t2: :pray:t2:

This is know issue regarding clock component that is not in sync with systme clock. Here is a expert solution from @Patryk_F

Interpretation:

And what if you are just dealing with 1 Sceond only, that is 1000 ms, then you inaccuracy will be reduced to 2/60.

3 Likes

is there no error here, because according to my logic it should be "Less Than and Equal to" not "Less Than"

It shoud be as it is.

Condition is we need to cross the 1000 mark.

ok, thank you so much

And what about the interval does it need to change, because if it doesn't touch 1000ms then it will wait after the next 1000ms

Why it woun't reach to the level, since clock will always keep updating global millis. One more thing try to lerarn what's is going at every line of code. That will provide you more insite about how program is written and how you can decorate instructions for your need, and how you can come up with your own version or with completely new way of programming. Thanks

See also here, for a blocks only solution, based upon Scott Ferguson's work

There are also extensions available that handle clock timer issues.

1 Like

New Stopwatch extension / app
Here is a test app with a new (simple) Stopwatch extension. It doesn't lose a single millisecond and should also work in the background or in idle mode (at least on most devices).
If not, a Foreground service must also be used.
precise_Stopwatch.aia (12.3 KB)

Try it and report if it works on your device (also in idle/sleep mode).

Only a few blocks are needed:
Stopwatch

The GIF animation only runs with 25 frames/sec, so the millis run slower than on a real device.

Extension blocks

1 Like

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