AbstractDoubleTimeSource

Deprecated

Using AbstractDoubleTimeSource is no longer recommended, use AbstractLongTimeSource instead.

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

Since Kotlin

1.3

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.3

Functions

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

Marks a point in time on this time source.

Since Kotlin 1.3
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(): Double

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

Since Kotlin 1.3