Files
kotlin-fork/stdlib/ktSrc/System.kt
T
Andrey Breslav 4579c9826f Reverting problematic commits:
fa500f453d	Alex Tkachman	Today 19:47
725bebc23f	Alex Tkachman	Today 19:36
2011-12-27 21:26:20 +04:00

20 lines
447 B
Kotlin

package std.util
/**
Executes current block and returns elapsed time in milliseconds
*/
fun measureTimeMillis(block: () -> Unit) : Long {
val start = System.currentTimeMillis()
block()
return System.currentTimeMillis() - start
}
/**
Executes current block and returns elapsed time in milliseconds
*/
fun measureTimeNano(block: () -> Unit) : Long {
val start = System.nanoTime()
block()
return System.nanoTime() - start
}