TimeSource

interface TimeSource

A source of time for measuring time intervals.

The only operation provided by the time source is markNow. It returns a TimeMark, which can be used to query the elapsed time later.

Since Kotlin

1.3

See also

Types

Companion
Link copied to clipboard
object Companion
Monotonic
Link copied to clipboard
object Monotonic : TimeSource

The most precise time source available in the platform.

Functions

markNow
Link copied to clipboard
abstract fun markNow(): TimeMark

Marks a point in time on this time source.

Inheritors

Monotonic
Link copied to clipboard
AbstractLongTimeSource
Link copied to clipboard
AbstractDoubleTimeSource
Link copied to clipboard

Extensions

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

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

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

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