Clock

Common
JVM
JS
Native
1.3
interface Clock

A source of time for measuring time intervals.

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

See Also

measureTime

measureTimedValue

Functions

Common
JVM
JS
Native
1.0

markNow

Marks a time point on this clock.

abstract fun markNow(): ClockMark

Extension Functions

Common
JVM
JS
Native
1.3

measureTime

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

fun Clock.measureTime(block: () -> Unit): Duration
Common
JVM
JS
Native
1.3

measureTimedValue

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.

fun <T> Clock.measureTimedValue(
    block: () -> T
): TimedValue<T>

Inheritors

Common
JVM
JS
Native
1.3

AbstractDoubleClock

An abstract class used to implement clocks that return their readings as Double values in the specified unit.

abstract class AbstractDoubleClock : Clock
Common
JVM
JS
Native
1.3

AbstractLongClock

An abstract class used to implement clocks that return their readings as Long values in the specified unit.

abstract class AbstractLongClock : Clock

MonoClock

The most precise clock available in the platform.

Common
JS
1.3
object MonoClock : Clock
JVM
Native
1.3
object MonoClock : AbstractLongClock, Clock