Last Updated: February 25, 2016
·
4.948K
· amirtcheva

"Timer" in Scala

I was looking for a Timer class in Scala, equivalent to those in Java, and all I could find is this: http://www.scala-lang.org/api/2.11.0/scala-compiler/index.html#scala.tools.nsc.backend.icode.analysis.TypeFlowAnalysis$Timer

It seems like it doesn't come as part of the standard Utils library, so I used:

var now = System.nanoTime

var timeElapsed = System.nanoTime - now

To find the time elapsed between two pieces of code