Packages

o

scala.jdk.javaapi

DurationConverters

object DurationConverters

This object contains methods that convert between Scala and Java duration types.

The explicit conversion methods defined here are intended to be used in Java code. For Scala code, it is recommended to use the extension methods defined in scala.jdk.DurationConverters.

Source
DurationConverters.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. DurationConverters
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. def toJava(duration: FiniteDuration): Duration

    Convert a Scala FiniteDuration to a Java duration.

    Convert a Scala FiniteDuration to a Java duration. Note that the Scala duration keeps the time unit it was created with, while a Java duration always is a pair of seconds and nanos, so the unit it lost.

  2. def toScala(duration: Duration): FiniteDuration

    Convert a Java duration to a Scala duration.

    Convert a Java duration to a Scala duration. If the nanosecond part of the Java duration is zero, the returned duration will have a time unit of seconds. If there is a nanoseconds part, the Scala duration will have a time unit of nanoseconds.

    Exceptions thrown

    IllegalArgumentException If the given Java Duration is out of bounds of what can be expressed by FiniteDuration.