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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://computational-thinking-in-room11.gitbook.io/room-112-dhs/software-development/compass/navigation-using-directions/time.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
