All Downloads are FREE. Search and download functionalities are using the official Maven repository.

scribe.util.Time.scala Maven / Gradle / Ivy

The newest version!
package scribe.util

object Time {
  var function: () => Long = _

  reset()

  def apply(): Long = function()

  def contextualize[Return](t: => Long)(f: => Return): Return = {
    val old = function
    function = () => t
    try {
      f
    } finally {
      function = old
    }
  }

  def reset(): Unit = function = () => System.currentTimeMillis()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy