System.timeMillis method renamed to measureTimeMillis and measureTimeNano added

This commit is contained in:
Alex Tkachman
2011-12-20 12:54:21 +02:00
parent 0134276930
commit 117f03cbbf
2 changed files with 11 additions and 2 deletions
+10 -1
View File
@@ -3,8 +3,17 @@ namespace std.util
/**
Executes current block and returns elapsed time in milliseconds
*/
fun millisTime(block: fun() : Unit) : Long {
fun measureTimeMillis(block: fun() : Unit) : Long {
val start = System.currentTimeMillis()
block()
return System.currentTimeMillis() - start
}
/**
Executes current block and returns elapsed time in milliseconds
*/
fun measureTimeNano(block: fun() : Unit) : Long {
val start = System.nanoTime()
block()
return System.nanoTime() - start
}