AbstractLongTimeSource

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

Time marks returned by this time source can be compared for difference with other time marks obtained from the same time source.

Since Kotlin

1.9

Inheritors

Constructors

Link copied to clipboard
constructor(unit: DurationUnit)

Properties

Link copied to clipboard
protected val unit: DurationUnit

The unit in which this time source's readings are expressed.

Since Kotlin 1.9

Functions

Link copied to clipboard
open override fun markNow(): ComparableTimeMark

Marks a point in time on this time source.

Since Kotlin 1.9
Link copied to clipboard
inline fun TimeSource.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>

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
protected abstract fun read(): Long

This protected method should be overridden to return the current reading of the time source expressed as a Long number in the unit specified by the unit property.

Since Kotlin 1.9