> 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 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
```

![](/files/-LsyQhmGQC-KKZymB70P)

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.

![](/files/-LsyRmbjNw3csnkBpPLs)

```
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
```
