# FakeClock.Builder

Artifact: [androidx.media3:media3-test-utils](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/test/utils/FakeClock.java+class:androidx.media3.test.utils.FakeClock.Builder)

*** ** * ** ***


```
class FakeClock.Builder
```

<br />

*** ** * ** ***

A builder for `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeClock` instances.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeClock.Builder#Builder()()` Creates a new builder for `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeClock` instances. |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeClock!` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeClock.Builder#build()()` Builds a `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeClock` instance. |
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeClock.Builder!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeClock.Builder#setBootTimeMs(long)(bootTimeMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Sets the time the system was booted since the Unix Epoch, in milliseconds. |
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeClock.Builder!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeClock.Builder#setInitialTimeMs(long)(initialTimeMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Sets the initial elapsed time since the boot time, in milliseconds. |
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeClock.Builder!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeClock.Builder#setIsAutoAdvancing(boolean)(isAutoAdvancing: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Sets whether the clock should automatically advance the time to the time of the next message that is due to be sent. |
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeClock.Builder!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeClock.Builder#setMaxAutoAdvancingTimeDiffMs(long)(maxAutoAdvancingTimeDiffMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Sets the maximum time difference between two messages that the fake clock will automatically advance. |

## Public constructors

### Builder

```
Builder()
```

Creates a new builder for `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeClock` instances.

## Public functions

### build

```
fun build(): FakeClock!
```

Builds a `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeClock` instance.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeClock!` | The built `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeClock` instance. |

### setBootTimeMs

```
@CanIgnoreReturnValue
fun setBootTimeMs(bootTimeMs: Long): FakeClock.Builder!
```

Sets the time the system was booted since the Unix Epoch, in milliseconds.

The default value is 0.

| Parameters |
|---|---|
| `bootTimeMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The time the system was booted since the Unix Epoch, in milliseconds. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeClock.Builder!` | This builder. |

### setInitialTimeMs

```
@CanIgnoreReturnValue
fun setInitialTimeMs(initialTimeMs: Long): FakeClock.Builder!
```

Sets the initial elapsed time since the boot time, in milliseconds.

The default value is 0.

| Parameters |
|---|---|
| `initialTimeMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The initial elapsed time since the boot time, in milliseconds. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeClock.Builder!` | This builder. |

### setIsAutoAdvancing

```
@CanIgnoreReturnValue
fun setIsAutoAdvancing(isAutoAdvancing: Boolean): FakeClock.Builder!
```

Sets whether the clock should automatically advance the time to the time of the next message that is due to be sent.

The default value is false.

| Parameters |
|---|---|
| `isAutoAdvancing: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the clock should automatically advance the time. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeClock.Builder!` | This builder. |

### setMaxAutoAdvancingTimeDiffMs

```
@CanIgnoreReturnValue
fun setMaxAutoAdvancingTimeDiffMs(maxAutoAdvancingTimeDiffMs: Long): FakeClock.Builder!
```

Sets the maximum time difference between two messages that the fake clock will automatically advance.

The default value is `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeClock#DEFAULT_MAX_AUTO_ADVANCING_TIME_DIFF_MS()`.

| Parameters |
|---|---|
| `maxAutoAdvancingTimeDiffMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The maximum time difference in milliseconds. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeClock.Builder!` | This builder. |