Skip to content

Instantly share code, notes, and snippets.

@maxpert maxpert/Stopwatch.kt
Created Mar 16, 2016

What would you like to do?
A really simple stopwatch for Kotlin
object Stopwatch {
inline fun elapse(callback: () -> Unit): Long {
var start = System.currentTimeMillis()
return System.currentTimeMillis() - start
inline fun elapseNano(callback: () -> Unit): Long {
var start = System.nanoTime()
return System.nanoTime() - start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.