Time interval in milliseconds between two events

How to calculate the time interval in milliseconds between two events?

Here is my example which doesn't work:

[set TimeEvent1 to] [call Clock1.GetMillis instant] [call Clock1.Now]
[set TimeEvent2 to] [call Clock1.GetMillis instant] [call Clock1.Now]
[set Interval to] [[get TimeEvent2] - [get TimeEvent1]]

Your pseudo code looks correct
You might want to show us a screenshot of your relevant blocks...

Use the companion app and Do it to debug your blocks, see also tip 4 here App Inventor: How to Learn | Pura Vida Apps
see also Live Development, Testing, and Debugging Tools

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

Your Interval came back 0, right?

You just established that that your code runs very fast.

1 Like

Hello.
Thanks for your help.
I came to the conclusion that to calculate the interval in milliseconds it is better to use the call Clock1.Duration start end block

In what way? And in this way it doesn't seem to make much sense anyway.