DeterministicClock

class DeterministicClock(startEpochMillis: Long = 0) : PlatformClock

Deterministic clock for tests and fake servers.

Design note

Both clocks advance together:

Constructors

Link copied to clipboard
constructor(startEpochMillis: Long = 0)

Functions

Link copied to clipboard
fun advanceBy(duration: Duration)

Advances the clock by duration.

Link copied to clipboard
open override fun monotonicNanos(): Long
Link copied to clipboard
open override fun nowEpochMillis(): Long
Link copied to clipboard
fun setEpochMillis(value: Long)

Sets absolute epoch millis (monotonic clock is unaffected).