case class Seconds extends TemporalAmount with Product with Serializable
- Alphabetic
- By Inheritance
- Seconds
- Serializable
- Product
- Equals
- TemporalAmount
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def addTo(temporal: Temporal): Temporal
Adds this duration to the specified temporal object.
Adds this duration to the specified temporal object.
This returns a temporal object of the same observable type as the input with this duration added.
In most cases, it is clearer to reverse the calling pattern by using
Temporal#plus(TemporalAmount)
.// these two lines are equivalent, but the second approach is recommended dateTime = thisDuration.addTo(dateTime); dateTime = dateTime.plus(thisDuration);
The calculation will add the seconds, then nanos. Only non-zero amounts will be added.
This instance is immutable and unaffected by this method call.
- temporal
the temporal object to adjust, not null
- returns
an object of the same type with the adjustment made, not null
- Definition Classes
- Seconds → TemporalAmount
- Exceptions thrown
ArithmeticException
if numeric overflow occursDateTimeException
if unable to add
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
- val duration: Duration
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def get(unit: TemporalUnit): Long
Gets the value of the requested unit.
Gets the value of the requested unit.
This returns a value for each of the two supported units,
SECONDS
andNANOS
. All other units throw an exception.- unit
the { @code TemporalUnit} for which to return the value
- returns
the long value of the unit
- Definition Classes
- Seconds → TemporalAmount
- Exceptions thrown
DateTimeException
if the unit is not supportedUnsupportedTemporalTypeException
if the unit is not supported
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def getUnits(): List[TemporalUnit]
Gets the set of units supported by this duration.
Gets the set of units supported by this duration.
The supported units are
SECONDS
, andNANOS
. They are returned in the order seconds, nanos.This set can be used in conjunction with
#get(TemporalUnit)
to access the entire state of the duration.- returns
a list containing the seconds and nanos units, not null
- Definition Classes
- Seconds → TemporalAmount
- def isGreaterThan(other: Seconds): Boolean
Is this seconds instance greater than the specified number of seconds.
Is this seconds instance greater than the specified number of seconds.
- other
the other period, null means zero
- returns
true if this seconds instance is greater than the specified one
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isLessThan(other: Seconds): Boolean
Is this seconds instance less than the specified number of seconds.
Is this seconds instance less than the specified number of seconds.
- other
the other period, null means zero
- returns
true if this seconds instance is less than the specified one
- def minus(other: Seconds): Seconds
Returns a new instance with the specified number of seconds taken away.
Returns a new instance with the specified number of seconds taken away.
This instance is immutable and unaffected by this method call.
- other
the amount of seconds to take away, may be negative, null means zero
- returns
the new period minus the specified number of seconds
- Exceptions thrown
ArithmeticException
if the result overflows an int
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def plus(other: Seconds): Seconds
Returns a new instance with the specified number of seconds added.
Returns a new instance with the specified number of seconds added.
This instance is immutable and unaffected by this method call.
- other
the amount of seconds to add, may be negative, null means zero
- returns
the new period plus the specified number of seconds
- Exceptions thrown
ArithmeticException
if the result overflows an int
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- def seconds: Long
Gets the number of seconds that this period represents.
Gets the number of seconds that this period represents.
- returns
the number of seconds in the period
- def subtractFrom(temporal: Temporal): Temporal
Subtracts this duration from the specified temporal object.
Subtracts this duration from the specified temporal object.
This returns a temporal object of the same observable type as the input with this duration subtracted.
In most cases, it is clearer to reverse the calling pattern by using
Temporal#minus(TemporalAmount)
.// these two lines are equivalent, but the second approach is recommended dateTime = thisDuration.subtractFrom(dateTime); dateTime = dateTime.minus(thisDuration);
The calculation will subtract the seconds, then nanos. Only non-zero amounts will be added.
This instance is immutable and unaffected by this method call.
- temporal
the temporal object to adjust, not null
- returns
an object of the same type with the adjustment made, not null
- Definition Classes
- Seconds → TemporalAmount
- Exceptions thrown
ArithmeticException
if numeric overflow occursDateTimeException
if unable to subtract
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
Gets this instance as a String in the ISO8601 duration format.
Gets this instance as a String in the ISO8601 duration format.
For example, "PT4S" represents 4 seconds.
- returns
the value as an ISO8601 string
- Definition Classes
- Seconds → AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)