Duration

kyo.Duration$package.Duration
opaque object Duration

Companion object for Duration type.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Duration.type

Members list

Type members

Classlikes

case class InvalidDuration(message: String) extends Exception

Exception thrown for invalid duration parsing.

Exception thrown for invalid duration parsing.

Attributes

Supertypes
trait Product
trait Equals
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
enum Units(val factor: Double, val names: List[String])

Enumeration of time units with their conversion factors and names.

Enumeration of time units with their conversion factors and names.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Types

opaque type Value

Value members

Concrete methods

def fromJava(value: Duration): Duration

Converts a Java Duration to a Duration.

Converts a Java Duration to a Duration.

Value parameters

value

The Java Duration to convert

Attributes

Returns

A Duration instance

inline def fromNanos(value: Long): Duration

Creates a Duration from nanoseconds.

Creates a Duration from nanoseconds.

Value parameters

value

The number of nanoseconds

Attributes

Returns

A Duration instance

def fromScala(value: Duration): Duration

Converts a Scala Duration to a Duration.

Converts a Scala Duration to a Duration.

Value parameters

value

The Scala Duration to convert

Attributes

Returns

A Duration instance

def fromUnits(value: Long, unit: Units): Duration

Creates a Duration from a value and unit.

Creates a Duration from a value and unit.

Value parameters

unit

The unit of time

value

The numeric value

Attributes

Returns

A Duration instance

def parse(s: String): Result[InvalidDuration, Duration]

Parses a string representation of a duration.

Parses a string representation of a duration.

Value parameters

s

The string to parse

Attributes

Returns

A Result containing either the parsed Duration or an InvalidDuration error

Concrete fields

Represents infinite duration.

Represents infinite duration.

Attributes

val Zero: Duration

Represents zero duration.

Represents zero duration.

Attributes

Givens

Extensions

Extensions

extension (self: Duration)
infix inline def !=(that: Duration): Boolean
infix inline def *(factor: Double): Duration
infix inline def +(that: Duration): Duration
infix inline def <(that: Duration): Boolean
infix inline def <=(that: Duration): Boolean
infix inline def ==(that: Duration): Boolean
infix inline def >(that: Duration): Boolean
infix inline def >=(that: Duration): Boolean
inline def max(that: Duration): Duration
inline def min(that: Duration): Duration
inline def show: String

Converts the Duration to a human-readable string.

Converts the Duration to a human-readable string.

Attributes

Returns

A string representation of the Duration

inline def to(unit: Units): Long
inline def toDays: Long
inline def toHours: Long
def toJava: Duration

Converts the Duration to a Java Duration.

Converts the Duration to a Java Duration.

Attributes

Returns

A Java Duration instance

inline def toMicros: Long
inline def toMillis: Long
inline def toMinutes: Long
inline def toMonths: Long
inline def toNanos: Long
def toScala: Duration

Converts the Duration to a Scala Duration.

Converts the Duration to a Scala Duration.

Attributes

Returns

A Scala Duration instance

inline def toSeconds: Long
inline def toWeeks: Long
inline def toYears: Long