How much time has passed from one event to another?
There are lots of times when you want to know how much time has passed. One is in some kinds of animation, another is for programs that directly measure the elapsed time, like a stopwatch.
Find a method to measure the current time.
The usual method is to trigger
This returns the number of milliseconds since 12:00am 1. January 1970.
- Start the timer by reading and storing the current time
- Stop the timer by reading and storing the current time
- Calculate the difference by substracting the start time from the stop time.
Number of milliseconds elapsed: