codes.reactive.scalatime

Duration

object Duration

Factory object for obtaining instances of Duration.

Duration is a time-based amount of time, such as '34.5 seconds'.

Source
Duration.scala
Example:
  1. import codes.reactive.scalatime._
    
    // Obtain a Duration of 10 nano seconds
    val tenNanos = Duration.nanos(10)
    
    // Obtain a Duration of zero
    val zero = Duration.Nil
Note

Direct use of this object is not the only mechanism to obtain Duration instances. See also the syntax syntax for alternatives.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Duration
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  4. val Nil: scalatime.Duration

    Obtains a Duration of zero.

  5. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  6. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. def days(days: Long): scalatime.Duration

    Obtains a Duration representing a number of days.

  8. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  9. def equals(arg0: Any): Boolean

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

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. def from(amount: scalatime.TemporalAmount): Try[scalatime.Duration]

    Tries to obtain a Duration from a temporal amount which has an exact duration.

  12. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  13. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  14. def hours(hours: Long): scalatime.Duration

    Obtains a Duration representing a number of hours.

  15. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  16. def millis(millis: Long): scalatime.Duration

    Obtains a Duration representing a number of milliseconds.

  17. def minutes(minutes: Long): scalatime.Duration

    Obtains a Duration representing a number of minutes.

  18. def nanos(nanos: Long): scalatime.Duration

    Obtains a Duration representing a number of nanoseconds.

  19. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  20. final def notify(): Unit

    Definition Classes
    AnyRef
  21. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  22. def parse(text: String): Try[scalatime.Duration]

    Tries to obtain a Duration from text based on the ISO-8601 Duration format - PnDTnHnMn.nS - with days considered to be exactly 24 hours.

    Tries to obtain a Duration from text based on the ISO-8601 Duration format - PnDTnHnMn.nS - with days considered to be exactly 24 hours.

    Text Format

    The text starts with an optional sign, denoted by the ASCII negative or positive symbol. If negative, the whole period is negated.

    The ASCII letter "P" is next in upper or lower case.

    There are then four sections, each consisting of a number and a suffix. The sections have suffixes in ASCII of "D", "H", "M" and "S" for days, hours, minutes and seconds, accepted in upper or lower case.

    The suffixes must occur in order. The ASCII letter "T" must occur before the first occurrence, if any, of an hour, minute or second section. At least one of the four sections must be present, and if "T" is present there must be at least one section after the "T". The number part of each section must consist of one or more ASCII digits. The number may be prefixed by the ASCII negative or positive symbol. The number of days, hours and minutes must parse to an long. The number of seconds must parse to a long with optional fraction. The decimal point may be either a dot or a comma. The fractional part may have from zero to 9 digits.

    The leading plus/minus sign, and negative values for other units are not part of the ISO-8601 standard.

    Example:
    1. import codes.reactive.scalatime._
      
      // Parses as 20.345 seconds
      val dur1 = Duration.parse("PT20.345S")
      
      // Parses as 2 days, 3 hours, 4 minutes
      val dur2 = Duration.parse("P2DT3H4M")
      
      // Parses as minus 6 hours, 3 minutes
      val dur3 = Duration.parse("P-6H3M")
  23. def seconds(seconds: Long, nanoAdjuster: Long): scalatime.Duration

    Obtains a Duration representing a number of seconds adjusted by a number of nano-seconds.

  24. def seconds(seconds: Long): scalatime.Duration

    Obtains a Duration representing a number of seconds.

  25. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  26. def toString(): String

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

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped