> For the complete documentation index, see [llms.txt](https://computational-thinking-in-room11.gitbook.io/room-112-dhs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://computational-thinking-in-room11.gitbook.io/room-112-dhs/software-development/compass/navigation-using-directions/time.md).

# Time

Running Time

Running time is how long the program has been running in milliseconds

TIP: 1 second is 1,000 milliseconds

```
Elapsed Time:
    When Button Pressed
        set now to running time
        scroll now
  
\\where now is a user created variable
```

![](https://2507214486-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LpUPSf3tCxHePJxNjfg%2F-LsyPyTJeTwP8lUPCEep%2F-LsyQhmGQC-KKZymB70P%2Fimage.png?alt=media\&token=3dc94aaa-36b4-4f98-9914-31badc906765)

Time Stamps: the microbit has the ability to record the time using the advance: Time stamp button.&#x20;

If we want to measure the elapsed time of between two events that occur while program is running we can use these time stamps and a little math.

![](https://2507214486-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LpUPSf3tCxHePJxNjfg%2F-LsyRPDoELnnaNqC1_CN%2F-LsyRmbjNw3csnkBpPLs%2Fimage.png?alt=media\&token=f3248454-cd50-43c4-9615-db8ba05b0f77)

```
on event1 (your choice)
    set time1 to event time stamp
    
on event2 (also your choice but diff than event1)
    set time2 to event time stamp
    
on start
    set duration = 0

after event 2 occurs and time2 stored
    duration= time2 - time1
```
