Skip to content

Instantly share code, notes, and snippets.

@JohnMurray
Created January 22, 2014 17:04
Show Gist options
  • Save JohnMurray/8562630 to your computer and use it in GitHub Desktop.
Save JohnMurray/8562630 to your computer and use it in GitHub Desktop.
Simple timing wrapper for synchronous operations
def timing[A](x: => A): Int = {
import com.github.nscala_time.time.Imports._
import org.joda.time.PeriodType
val then = LocalDateTime.now
x
new Period(then, LocalDateTime.now, PeriodType.millis).getValue(0)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment