scala.concurrent.duration.DurationDouble

implicit final class DurationDouble extends AnyVal with DurationConversions

Value Members From scala.Any

final def ##(): Int

Equivalent to x.hashCode except for boxed numeric types and null . For numerics, it returns a hash value which is consistent with value equality: if two value type instances compare as true, then ## will produce the same hash value for each of them. For null returns a hashcode where null.hashCode throws a NullPointerException .

  • returns
    • a hash value consistent with ==
  • Definition Classes
    • Any

(defined at scala.Any###)

Value Members From scala.concurrent.duration.DurationConversions

def day: FiniteDuration

  • Definition Classes
    • DurationConversions

(defined at scala.concurrent.duration.DurationConversions)

def day[C](c: C)(implicit ev: Classifier[C]): R

  • Definition Classes
    • DurationConversions

(defined at scala.concurrent.duration.DurationConversions)

def days: FiniteDuration

  • Definition Classes
    • DurationConversions

(defined at scala.concurrent.duration.DurationConversions)

def days[C](c: C)(implicit ev: Classifier[C]): R

  • Definition Classes
    • DurationConversions

(defined at scala.concurrent.duration.DurationConversions)

def hour: FiniteDuration

  • Definition Classes
    • DurationConversions

(defined at scala.concurrent.duration.DurationConversions)

def hour[C](c: C)(implicit ev: Classifier[C]): R

  • Definition Classes
    • DurationConversions

(defined at scala.concurrent.duration.DurationConversions)

def hours: FiniteDuration

  • Definition Classes
    • DurationConversions

(defined at scala.concurrent.duration.DurationConversions)

def hours[C](c: C)(implicit ev: Classifier[C]): R

  • Definition Classes
    • DurationConversions

(defined at scala.concurrent.duration.DurationConversions)

def micro: FiniteDuration

  • Definition Classes
    • DurationConversions

(defined at scala.concurrent.duration.DurationConversions)

def micro[C](c: C)(implicit ev: Classifier[C]): R

  • Definition Classes
    • DurationConversions

(defined at scala.concurrent.duration.DurationConversions)

def micros: FiniteDuration

  • Definition Classes
    • DurationConversions

(defined at scala.concurrent.duration.DurationConversions)

def micros[C](c: C)(implicit ev: Classifier[C]): R

  • Definition Classes
    • DurationConversions

(defined at scala.concurrent.duration.DurationConversions)

def microsecond: FiniteDuration

  • Definition Classes
    • DurationConversions

(defined at scala.concurrent.duration.DurationConversions)

def microsecond[C](c: C)(implicit ev: Classifier[C]): R

  • Definition Classes
    • DurationConversions

(defined at scala.concurrent.duration.DurationConversions)

def microseconds: FiniteDuration

  • Definition Classes
    • DurationConversions

(defined at scala.concurrent.duration.DurationConversions)

def microseconds[C](c: C)(implicit ev: Classifier[C]): R

  • Definition Classes
    • DurationConversions

(defined at scala.concurrent.duration.DurationConversions)

def milli: FiniteDuration

  • Definition Classes
    • DurationConversions

(defined at scala.concurrent.duration.DurationConversions)

def milli[C](c: C)(implicit ev: Classifier[C]): R

  • Definition Classes
    • DurationConversions

(defined at scala.concurrent.duration.DurationConversions)

def millis: FiniteDuration

  • Definition Classes
    • DurationConversions

(defined at scala.concurrent.duration.DurationConversions)

def millis[C](c: C)(implicit ev: Classifier[C]): R

  • Definition Classes
    • DurationConversions

(defined at scala.concurrent.duration.DurationConversions)

def millisecond: FiniteDuration

  • Definition Classes
    • DurationConversions

(defined at scala.concurrent.duration.DurationConversions)

def millisecond[C](c: C)(implicit ev: Classifier[C]): R

  • Definition Classes
    • DurationConversions

(defined at scala.concurrent.duration.DurationConversions)

def milliseconds: FiniteDuration

  • Definition Classes
    • DurationConversions

(defined at scala.concurrent.duration.DurationConversions)

def milliseconds[C](c: C)(implicit ev: Classifier[C]): R

  • Definition Classes
    • DurationConversions

(defined at scala.concurrent.duration.DurationConversions)

def minute: FiniteDuration

  • Definition Classes
    • DurationConversions

(defined at scala.concurrent.duration.DurationConversions)

def minute[C](c: C)(implicit ev: Classifier[C]): R

  • Definition Classes
    • DurationConversions

(defined at scala.concurrent.duration.DurationConversions)

def minutes: FiniteDuration

  • Definition Classes
    • DurationConversions

(defined at scala.concurrent.duration.DurationConversions)

def minutes[C](c: C)(implicit ev: Classifier[C]): R

  • Definition Classes
    • DurationConversions

(defined at scala.concurrent.duration.DurationConversions)

def nano: FiniteDuration

  • Definition Classes
    • DurationConversions

(defined at scala.concurrent.duration.DurationConversions)

def nano[C](c: C)(implicit ev: Classifier[C]): R

  • Definition Classes
    • DurationConversions

(defined at scala.concurrent.duration.DurationConversions)

def nanos: FiniteDuration

  • Definition Classes
    • DurationConversions

(defined at scala.concurrent.duration.DurationConversions)

def nanos[C](c: C)(implicit ev: Classifier[C]): R

  • Definition Classes
    • DurationConversions

(defined at scala.concurrent.duration.DurationConversions)

def nanosecond: FiniteDuration

  • Definition Classes
    • DurationConversions

(defined at scala.concurrent.duration.DurationConversions)

def nanosecond[C](c: C)(implicit ev: Classifier[C]): R

  • Definition Classes
    • DurationConversions

(defined at scala.concurrent.duration.DurationConversions)

def nanoseconds: FiniteDuration

  • Definition Classes
    • DurationConversions

(defined at scala.concurrent.duration.DurationConversions)

def nanoseconds[C](c: C)(implicit ev: Classifier[C]): R

  • Definition Classes
    • DurationConversions

(defined at scala.concurrent.duration.DurationConversions)

def second: FiniteDuration

  • Definition Classes
    • DurationConversions

(defined at scala.concurrent.duration.DurationConversions)

def second[C](c: C)(implicit ev: Classifier[C]): R

  • Definition Classes
    • DurationConversions

(defined at scala.concurrent.duration.DurationConversions)

def seconds: FiniteDuration

  • Definition Classes
    • DurationConversions

(defined at scala.concurrent.duration.DurationConversions)

def seconds[C](c: C)(implicit ev: Classifier[C]): R

  • Definition Classes
    • DurationConversions

(defined at scala.concurrent.duration.DurationConversions)

Instance Constructors From scala.concurrent.duration.DurationDouble

new DurationDouble(d: Double)

(defined at scala.concurrent.duration.DurationDouble)

Value Members From scala.concurrent.duration.DurationDouble

def durationIn(unit: TimeUnit): FiniteDuration

  • Attributes
    • protected
  • Definition Classes
    • DurationDouble → DurationConversions (defined at scala.concurrent.duration.DurationDouble)

Full Source:

package scala.concurrent

import scala.language.implicitConversions

package object duration {
  /**
   * This object can be used as closing token if you prefer dot-less style but do not want
   * to enable language.postfixOps:
   *
   * {{{
   * import scala.concurrent.duration._
   *
   * val duration = 2 seconds span
   * }}}
   */
  object span

  /**
   * This object can be used as closing token for declaring a deadline at some future point
   * in time:
   *
   * {{{
   * import scala.concurrent.duration._
   *
   * val deadline = 3 seconds fromNow
   * }}}
   */
  object fromNow

  type TimeUnit          = java.util.concurrent.TimeUnit
  final val DAYS         = java.util.concurrent.TimeUnit.DAYS
  final val HOURS        = java.util.concurrent.TimeUnit.HOURS
  final val MICROSECONDS = java.util.concurrent.TimeUnit.MICROSECONDS
  final val MILLISECONDS = java.util.concurrent.TimeUnit.MILLISECONDS
  final val MINUTES      = java.util.concurrent.TimeUnit.MINUTES
  final val NANOSECONDS  = java.util.concurrent.TimeUnit.NANOSECONDS
  final val SECONDS      = java.util.concurrent.TimeUnit.SECONDS

  implicit def pairIntToDuration(p: (Int, TimeUnit)): Duration         = Duration(p._1.toLong, p._2)
  implicit def pairLongToDuration(p: (Long, TimeUnit)): FiniteDuration = Duration(p._1, p._2)
  implicit def durationToPair(d: Duration): (Long, TimeUnit)           = (d.length, d.unit)

  implicit final class DurationInt(private val n: Int) extends AnyVal with DurationConversions {
    override protected def durationIn(unit: TimeUnit): FiniteDuration = Duration(n.toLong, unit)
  }

  implicit final class DurationLong(private val n: Long) extends AnyVal with DurationConversions {
    override protected def durationIn(unit: TimeUnit): FiniteDuration = Duration(n, unit)
  }

  implicit final class DurationDouble(private val d: Double) extends AnyVal with DurationConversions {
    override protected def durationIn(unit: TimeUnit): FiniteDuration =
      Duration(d, unit) match {
        case f: FiniteDuration => f
        case _ => throw new IllegalArgumentException("Duration DSL not applicable to " + d)
      }
  }

  /*
   * Avoid reflection based invocation by using non-duck type
   */
  implicit final class IntMult(private val i: Int) extends AnyVal {
    def *(d: Duration) = d * i.toDouble
    def *(d: FiniteDuration) = d * i.toLong
  }

  implicit final class LongMult(private val i: Long) extends AnyVal {
    def *(d: Duration) = d * i.toDouble
    def *(d: FiniteDuration) = d * i.toLong
  }

  implicit final class DoubleMult(private val f: Double) extends AnyVal {
    def *(d: Duration) = d * f.toDouble
  }
}