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]]
Taifun
August 11, 2024, 6:07pm
2
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 Taifun.
ABG
August 11, 2024, 7:52pm
3
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
Anke
August 19, 2024, 5:25pm
5
In what way? And in this way it doesn't seem to make much sense anyway.