Monotonic

The most precise time source available in the platform.

This time source returns its readings from a source of monotonic time when it is available in a target platform, and resorts to a non-monotonic time source otherwise.

The function markNow of this time source returns the specialized ValueTimeMark that is an inline value class wrapping a platform-dependent time reading value.

Since Kotlin

1.9

Types

Link copied to clipboard

A specialized kotlin.time.TimeMark returned by TimeSource.Monotonic time source.

Since Kotlin 1.9

Functions

Link copied to clipboard

Marks a point in time on this time source.

Since Kotlin 1.9
Link copied to clipboard
inline fun TimeSource.measureTime(block: () -> Unit): Duration
inline fun TimeSource.Monotonic.measureTime(block: () -> Unit): Duration

Executes the given function block and returns the duration of elapsed time interval.

Since Kotlin 1.9
Link copied to clipboard
inline fun <T> TimeSource.measureTimedValue(block: () -> T): TimedValue<T>
inline fun <T> TimeSource.Monotonic.measureTimedValue(block: () -> T): TimedValue<T>

Executes the given function block and returns an instance of TimedValue class, containing both the result of function execution and the duration of elapsed time interval.

Since Kotlin 1.9
Link copied to clipboard
open override fun toString(): String
Since Kotlin 1.9