# Utilizing Time in your code

## ElapsedTime()

ElapsedTime is a class that can easily get you the amount of time that has passed since you pressed init() and to the current time step.

### Instructions for use:

1. First create the variable at the top of your code.

```csharp
ElapsedTime mStateTime;
```

&#x20;    2\. Then create assign it to a new instance of the class.

```csharp
//Inside Init
mStateTime = new ElapsedTime();
```

&#x20;    3\. Then make sure that it starts when you click the start button

```csharp
public override void onStart()
{
    mStateTime.startTime();
}
```

&#x20;   4\. Then use it inside your loop using these methods:

* timeMilliseconds()
* timeSeconds()
* timeMinutes()

For Example:

```csharp
telemetry.addData("Time", mStateTime.timeSeconds().ToString());
```

&#x20;
