import kotlin.time.* @UseExperimental(ExperimentalTime::class) fun main() { val (value, duration) = measureTimedValue { Thread.sleep(100) 42 } // 42 println(number) // e.g. 103 ms println(duration) }