# TimerSpan

Artifact: [androidx.car.app:app](https://developer.android.com/jetpack/androidx/releases/car-app) [View Source](https://cs.android.com/search?q=file:androidx/car/app/model/TimerSpan.java+class:androidx.car.app.model.TimerSpan) Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.8.0)

*** ** * ** ***


```
@ExperimentalCarApi
@CarProtocol
class TimerSpan : CarSpan
```

<br />

|---|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) ||||
| ↳ | [android.text.style.CharacterStyle](https://developer.android.com/reference/android/text/style/CharacterStyle.html) |||
|   | ↳ | [androidx.car.app.model.CarSpan](https://developer.android.com/reference/kotlin/androidx/car/app/model/CarSpan) ||
|   |   | ↳ | [androidx.car.app.model.TimerSpan](https://developer.android.com/reference/kotlin/androidx/car/app/model/TimerSpan) |

*** ** * ** ***

A `https://developer.android.com/reference/kotlin/androidx/car/app/model/CarSpan` that represents a timer.

This span can be used within text to display a live-updating timer. The timer will count up from the provided start time, which is based on the elapsed real time since device boot, as provided by `SystemClock.elapsedRealtime()`.

For example, a `https://developer.android.com/reference/kotlin/androidx/car/app/model/TimerSpan` can be used in a `https://developer.android.com/reference/kotlin/androidx/car/app/model/CarText` to show how much time has passed since a certain event. The exact rendering of the timer is dependent on the car screen.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/CarSpan` |   |

## Summary

| ### Public functions |
|---|---|
| `java-static https://developer.android.com/reference/kotlin/androidx/car/app/model/TimerSpan` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/TimerSpan#create(long)(elapsedRealtimeMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Creates a `https://developer.android.com/reference/kotlin/androidx/car/app/model/TimerSpan` from a start time in elapsed real time since device boot. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/TimerSpan#equals(java.lang.Object)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/TimerSpan#getElapsedRealtimeMillis()()` Returns the start time of the timer in milliseconds since device boot. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/TimerSpan#hashCode()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/TimerSpan#toString()()` |

| ### Inherited functions |
|---|
| From [androidx.car.app.model.CarSpan](https://developer.android.com/reference/kotlin/androidx/car/app/model/CarSpan) |---|---| | `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/CarSpan#updateDrawState(android.text.TextPaint)(tp: https://developer.android.com/reference/android/text/TextPaint.html)` | |
| From [android.text.style.CharacterStyle](https://developer.android.com/reference/android/text/style/CharacterStyle.html) |---|---| | `https://developer.android.com/reference/android/text/style/CharacterStyle.html!` | `https://developer.android.com/reference/android/text/style/CharacterStyle.html#getUnderlying()()` | | `abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/android/text/style/CharacterStyle.html#updateDrawState(android.text.TextPaint)(p: https://developer.android.com/reference/android/text/TextPaint.html!)` | | `java-static https://developer.android.com/reference/android/text/style/CharacterStyle.html!` | `https://developer.android.com/reference/android/text/style/CharacterStyle.html#wrap(android.text.style.CharacterStyle)(cs: https://developer.android.com/reference/android/text/style/CharacterStyle.html!)` | |

## Public functions

### create

Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.8.0)

```
java-static fun create(elapsedRealtimeMillis: Long): TimerSpan
```

Creates a `https://developer.android.com/reference/kotlin/androidx/car/app/model/TimerSpan` from a start time in elapsed real time since device boot.

The timer will count up if the provided `elapsedRealtimeMillis` is in the past relative to the current `SystemClock.elapsedRealtime()`, and will count down if it is in the future.

| Parameters |
|---|---|
| `elapsedRealtimeMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | the start time in milliseconds using `SystemClock .elapsedRealtime()`. |

### equals

```
fun equals(other: Any?): Boolean
```

### getElapsedRealtimeMillis

Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.8.0)

```
fun getElapsedRealtimeMillis(): Long
```

Returns the start time of the timer in milliseconds since device boot.

### hashCode

```
fun hashCode(): Int
```

### toString

```
fun toString(): String
```