def apply()

in src/main/scala/com/twitter/iago/util/PrettyDuration.scala [39:54]


  def apply(duration: Duration): String = {

    val nanos = duration.inNanoseconds
    val nanosD = math.abs(nanos.toDouble)

    def walk: String = {
      for (Unit(limit, divisor, nameOfUnit) <- units) {
        val next = nanosD / divisor
        if (math.round(next) < limit)
          return threeSignificantDigits(next) + " " + nameOfUnit
      }
      throw new Exception("Can't happen")
    }
    if (nanos < 0) return "-" + walk
    walk
  }