Stopwatch issue

Hi, I had created a stopwatch app by using thunkable and installed it on my phone. I tried to compare it with the online stopwatch and apparently the stopwatch app I created is slower than the online stopwatch. I tried to compare with my other phone’s inbuild stopwatch but I still get the same results. Can somebody explain to me the reason for my stopwatch not being accurate? By the way the stopwatch is accurate when I use the thunkable live. The third image shows the blocks diagram of my stopwatch app.

What sort of phone are you using @ffw11166?

What is your timer interval set to?

I am using Samsung S20 plus and Samsung S9.

The time interval I set is 10 milliseconds

I have this exact same issue. I’m on an iPhone 12



Use this code for a stopwatch : works fine for me
You can remove the lap list and saved milliseconds and seconds if you dont want the laps to be counted
And this for a timer :

I will be writing a tutorial on this

This block combo is not ideal and will not stay true to a timer. It’s almost impossible for your phone running some couple blocks to complete a 1000 ms loop accurately go ahead and test it out over 10 minutes if you think I’m wrong.

In essence on an older phone you’ll start to see lag in the time on a newer phone this will be less noticeable. This is due to the fact that you’re running a loop and you’re not just checking times and displaying the times on the screen.

Relying on code to keep time is unreliable. Instead count on your phone to keep time and use the code to check in on any time differences since you started tracking time.
Have you considered, using the blocks seconds since 1970. My preferred method of creating a stopwatch or a timer of any sort is to use those blocks. When I hit start I save the second since 1972 a variable.

If I want to display the count on the screen I use a loop. In the loop I subtract the variable I stored originally from the block second since 1970. This will give me a duration of time that has passed since I originally saved the variable therefore a more accurate representation of the time that has passed. If you put that loop on a very short delay it will look just like a stopwatch counter. You’ll need to do some math tutor in milliseconds back into seconds or back in 10 minutes we’re back in two minutes and seconds but this is the most accurate way for you to run a stopwatch

Actually, I’d probably use the timer block to fire the time check and print to screen action.

3 Likes

Yes @jared You are right
Is this correct?