def /()

in util-core/src/main/scala/com/twitter/util/Duration.scala [421:445]


  def /(x: Long): Duration =
    if (x != 0) fromNanoseconds(nanos / x)
    else if (nanos == 0) Undefined
    else if (nanos < 0) Bottom
    else Top

  /**
   * Scales this `Duration` by dividing by `x`.
   */
  def /(x: Double): Duration =
    if (x == 0.0) this / 0
    else this * (1.0 / x)

  /**
   * Scales this `Duration` by modding by `x`.
   */
  def %(x: Duration): Duration = x match {
    case Undefined => Undefined
    case ns if ns.isZero => Undefined
    // Analogous to `case Top | Bottom =>`.
    // We pattern match this way so that the compiler
    // recognizes a fully exhaustive pattern match.
    case ns if !ns.isFinite => this
    case ns => fromNanoseconds(nanos % ns.inNanoseconds)
  }