Movatterモバイル変換


[0]ホーム

URL:


Scala 3
3.7.4
LearnInstallPlaygroundFind A LibraryCommunityBlog
Scala 3
LearnInstallPlaygroundFind A LibraryCommunityBlog
DocsAPI
Generated with
Copyright (c) 2002-2025, LAMP/EPFL
Copyright (c) 2002-2025, LAMP/EPFL
Scala 3/scala/scala.concurrent/scala.concurrent.duration/Duration

Duration

scala.concurrent.duration.Duration
See theDuration companion class
objectDuration

Attributes

Companion
class
Source
Duration.scala
Graph
Supertypes
classObject
traitMatchable
classAny
Self type

Members list

Type members

Classlikes

The natural ordering of durations matches the natural ordering for Double, including non-finite values.

The natural ordering of durations matches the natural ordering for Double, including non-finite values.

Attributes

Source
Duration.scala
Supertypes
Self type
sealed abstractclassInfinite extendsDuration

Attributes

Source
Duration.scala
Supertypes
classDuration
classObject
traitMatchable
classAny
Show all

Value members

Concrete methods

defapply(length:Double,unit:TimeUnit):Duration

Construct a Duration from the given length and unit.

Construct a Duration from the given length and unit. Observe that nanosecond precision may be lost if

- the unit is NANOSECONDS - and the length has an absolute value greater than2^53

Infinite inputs (and NaN) are converted intoDuration.Inf,Duration.MinusInf andDuration.Undefined, respectively.

Attributes

Throws

IllegalArgumentExceptionif the length was finite but the resulting duration cannot be expressed as aFiniteDuration

Source
Duration.scala

Construct a finite duration from the given length and time unit.

Construct a finite duration from the given length and time unit. The unit given is retained throughout calculations as long as possible, so that it can be retrieved later.

Attributes

Source
Duration.scala

Construct a finite duration from the given length and time unit, where the latter is looked up in a list of string representation.

Construct a finite duration from the given length and time unit, where the latter is looked up in a list of string representation. Valid choices are:

d, day, h, hr, hour, m, min, minute, s, sec, second, ms, milli, millisecond, µs, micro, microsecond, ns, nano, nanosecond and their pluralized forms (for every but the first mentioned form of each unit, i.e. no "ds", but "days").

Attributes

Source
Duration.scala

Parse String into Duration.

Parse String into Duration. Format is"<length><unit>", where whitespace is allowed before, between and after the parts. Infinities are designated by"Inf","PlusInf","+Inf","Duration.Inf" and"-Inf","MinusInf" or"Duration.MinusInf". Undefined is designated by"Duration.Undefined".

Attributes

Throws

NumberFormatException if format is not parsable

Source
Duration.scala

Construct a finite duration from the given length and time unit.

Construct a finite duration from the given length and time unit. The unit given is retained throughout calculations as long as possible, so that it can be retrieved later.

Attributes

Source
Duration.scala
defcreate(length:Double,unit:TimeUnit):Duration

Construct a Duration from the given length and unit.

Construct a Duration from the given length and unit. Observe that nanosecond precision may be lost if

- the unit is NANOSECONDS - and the length has an absolute value greater than2^53

Infinite inputs (and NaN) are converted intoDuration.Inf,Duration.MinusInf andDuration.Undefined, respectively.

Attributes

Throws

IllegalArgumentExceptionif the length was finite but the resulting duration cannot be expressed as aFiniteDuration

Source
Duration.scala

Construct a finite duration from the given length and time unit, where the latter is looked up in a list of string representation.

Construct a finite duration from the given length and time unit, where the latter is looked up in a list of string representation. Valid choices are:

d, day, h, hour, min, minute, s, sec, second, ms, milli, millisecond, µs, micro, microsecond, ns, nano, nanosecond and their pluralized forms (for every but the first mentioned form of each unit, i.e. no "ds", but "days").

Attributes

Source
Duration.scala

Parse String into Duration.

Parse String into Duration. Format is"<length><unit>", where whitespace is allowed before, between and after the parts. Infinities are designated by"Inf","PlusInf","+Inf" and"-Inf" or"MinusInf".

Attributes

Throws

NumberFormatException if format is not parsable

Source
Duration.scala

Construct a possibly infinite or undefined Duration from the given number of nanoseconds.

Construct a possibly infinite or undefined Duration from the given number of nanoseconds.

-Double.PositiveInfinity is mapped toDuration.Inf -Double.NegativeInfinity is mapped toDuration.MinusInf -Double.NaN is mapped toDuration.Undefined --0d is mapped toDuration.Zero (exactly like0d)

The semantics of the resulting Duration objects matches the semantics of their Double counterparts with respect to arithmetic operations.

Attributes

Throws

IllegalArgumentExceptionif the length was finite but the resulting duration cannot be expressed as aFiniteDuration

Source
Duration.scala

Construct a finite duration from the given number of nanoseconds.

Construct a finite duration from the given number of nanoseconds. The result will have the coarsest possible time unit which can exactly express this duration.

Attributes

Throws

IllegalArgumentExceptionforLong.MinValue since that would lead to inconsistent behavior afterwards (cannot be negated)

Source
Duration.scala

Extract length and time unit out of a string, where the format must match the description forapply(String).

Extract length and time unit out of a string, where the format must match the description forapply(String). The extractor will not match for malformed strings or non-finite durations.

Attributes

Source
Duration.scala

Extract length and time unit out of a duration, if it is finite.

Extract length and time unit out of a duration, if it is finite.

Attributes

Source
Duration.scala

Concrete fields

Infinite duration: greater than any other (apart from Undefined) and not equal to any other but itself.

Infinite duration: greater than any other (apart from Undefined) and not equal to any other but itself. This value closely corresponds to Double.PositiveInfinity, matching its semantics in arithmetic operations.

Attributes

Source
Duration.scala

Infinite duration: less than any other and not equal to any other but itself.

Infinite duration: less than any other and not equal to any other but itself. This value closely corresponds to Double.NegativeInfinity, matching its semantics in arithmetic operations.

Attributes

Source
Duration.scala

The Undefined value corresponds closely to Double.NaN:

The Undefined value corresponds closely to Double.NaN:

- it is the result of otherwise invalid operations - it does not equal itself (according toequals()) - it compares greater than any other Duration apart from itself (for whichcompare returns 0)

The particular comparison semantics mirror those of Double.NaN.

Useeq when checking an input of a method against this value.

Attributes

Source
Duration.scala

Preconstructed value of0.days.

Preconstructed value of0.days.

Attributes

Source
Duration.scala
In this article
Generated with
Copyright (c) 2002-2025, LAMP/EPFL
Copyright (c) 2002-2025, LAMP/EPFL

[8]ページ先頭

©2009-2025 Movatter.jp