Skip to content

Suiteopensavvy.prepared.suitenowMillis

nowMillis


Accesses the current time inside the test, in milliseconds.

Example

test("Using the virtual time") {
    val initial = time.nowMillis

    // …do something…
    delay(5000)

    check(time.nowMillis == initial + 5000)
}

For the specific use-case of measuring elapsed time, see Time.source.

Integration with datetime libraries

To retrieve an `Instant` instead of `Long`, use the KotlinX.Datetime or the Java Time compatibility libraries.