akka.util

Duration

class Duration extends Serializable with Ordered[Duration]

Utility for working with java.util.concurrent.TimeUnit durations.

Examples of usage from Java:

import akka.util.FiniteDuration;
import java.util.concurrent.TimeUnit;

Duration duration = new FiniteDuration(100, MILLISECONDS);
Duration duration = new FiniteDuration(5, "seconds");

duration.toNanos();

Examples of usage from Scala:

import akka.util.Duration
import java.util.concurrent.TimeUnit

val duration = Duration(100, MILLISECONDS)
val duration = Duration(100, "millis")

duration.toNanos
duration < 1.second
duration <= Duration.Inf

Implicits are also provided for Int, Long and Double. Example usage:

import akka.util.duration._

val duration = 100 millis

Extractors, parsing and arithmetic are also included:

val d = Duration("1.2 µs")
val Duration(length, unit) = 5 millis
val d2 = d * 2.5
val d3 = d2 + 1.millisecond

Attributes
abstract
Linear Supertypes
Ordered[Duration], Comparable[Duration], Serializable, Serializable, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. Duration
  2. Ordered
  3. Comparable
  4. Serializable
  5. Serializable
  6. AnyRef
  7. Any
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Duration ()

Abstract Value Members

  1. def * (factor: Double): Duration

    Attributes
    abstract
  2. def + (other: Duration): Duration

    Attributes
    abstract
  3. def - (other: Duration): Duration

    Attributes
    abstract
  4. def / (other: Duration): Double

    Attributes
    abstract
  5. def / (factor: Double): Duration

    Attributes
    abstract
  6. def compare (that: Duration): Int

    Attributes
    abstract
    Definition Classes
    Ordered
  7. def finite_? : Boolean

    Attributes
    abstract
  8. def length : Long

    Attributes
    abstract
  9. def printHMS : String

    Attributes
    abstract
  10. def toDays : Long

    Attributes
    abstract
  11. def toHours : Long

    Attributes
    abstract
  12. def toMicros : Long

    Attributes
    abstract
  13. def toMillis : Long

    Attributes
    abstract
  14. def toMinutes : Long

    Attributes
    abstract
  15. def toNanos : Long

    Attributes
    abstract
  16. def toSeconds : Long

    Attributes
    abstract
  17. def toUnit (unit: TimeUnit): Double

    Attributes
    abstract
  18. def unary_- : Duration

    Attributes
    abstract
  19. def unit : TimeUnit

    Attributes
    abstract

Concrete Value Members

  1. def != (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  2. def != (arg0: Any): Boolean

    Attributes
    final
    Definition Classes
    Any
  3. def ## (): Int

    Attributes
    final
    Definition Classes
    AnyRef → Any
  4. def < (that: Duration): Boolean

    Definition Classes
    Ordered
  5. def <= (that: Duration): Boolean

    Definition Classes
    Ordered
  6. def == (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  7. def == (arg0: Any): Boolean

    Attributes
    final
    Definition Classes
    Any
  8. def > (that: Duration): Boolean

    Definition Classes
    Ordered
  9. def >= (that: Duration): Boolean

    Definition Classes
    Ordered
  10. def asInstanceOf [T0] : T0

    Attributes
    final
    Definition Classes
    Any
  11. def clone (): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  12. def compareTo (that: Duration): Int

    Definition Classes
    Ordered → Comparable
  13. def div (other: Duration): Double

  14. def div (factor: Double): Duration

  15. def eq (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  16. def equals (arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  17. def finalize (): Unit

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  18. def fromNow : Deadline

  19. def getClass (): java.lang.Class[_]

    Attributes
    final
    Definition Classes
    AnyRef → Any
  20. def gt (other: Duration): Boolean

  21. def gteq (other: Duration): Boolean

  22. def hashCode (): Int

    Definition Classes
    AnyRef → Any
  23. def isFinite (): Boolean

  24. def isInstanceOf [T0] : Boolean

    Attributes
    final
    Definition Classes
    Any
  25. def lt (other: Duration): Boolean

  26. def lteq (other: Duration): Boolean

  27. def max (other: Duration): Duration

  28. def min (other: Duration): Duration

  29. def minus (other: Duration): Duration

  30. def mul (factor: Double): Duration

  31. def ne (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  32. def neg (): Duration

  33. def notify (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  34. def notifyAll (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  35. def plus (other: Duration): Duration

  36. def sleep (): Unit

  37. def synchronized [T0] (arg0: ⇒ T0): T0

    Attributes
    final
    Definition Classes
    AnyRef
  38. def toString (): String

    Definition Classes
    AnyRef → Any
  39. def wait (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  40. def wait (arg0: Long, arg1: Int): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  41. def wait (arg0: Long): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()

Inherited from Ordered[Duration]

Inherited from Comparable[Duration]

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any