Suite • opensavvy.prepared.suite • Time
Time¶
Constructors¶
Time
¶
@ExperimentalCoroutinesApi
@ExperimentalTime
constructor(environment: TestEnvironment)
Properties¶
clock
¶
Creates a Clock that follows the virtual time in this test.
now
¶
Access the current virtual time within this test, as an Instant.
nowMillis
¶
Accesses the current time inside the test, in milliseconds.
scheduler
¶
Accessor for the underlying TestCoroutineScheduler
, which controls the current time.
source
¶
Access a time source which can be used to measure elapsed time, as controlled with time
.
Functions¶
advanceBy
¶
@ExperimentalCoroutinesApi
fun Time.advanceBy(delay: Duration)
Advances the current time by delay
.
advanceByMillis
¶
@ExperimentalCoroutinesApi
fun Time.advanceByMillis(delay: Long)
Advances the current time by delay
.
advanceUntilIdle
¶
Runs all enqueued tasks in the specified order, advancing the virtual time as needed until there are no more scheduled tasks.
delayUntil
¶
@ExperimentalTime
@ExperimentalCoroutinesApi
suspend fun Time.delayUntil(instant: )
Delays until the virtual time reaches instant
, executing all enqueued tasks in order.
@ExperimentalTime
@ExperimentalCoroutinesApi
suspend fun Time.delayUntil(isoString: String)
Delays until the virtual time reaches isoString
, formatted as an ISO 8601 timestamp, executing all enqueued tasks in order.
runCurrent
¶
Runs all enqueued tasks at this moment in the virtual time.
set
¶
@ExperimentalTime
@ExperimentalCoroutinesApi
suspend fun Time.set(instant: )
Advances the virtual time until it reaches instant
.
@ExperimentalTime
@ExperimentalCoroutinesApi
suspend fun Time.set(isoString: String)
Advances the virtual time until it reaches isoString
, formatted as an ISO 8601 timestamp.