Seconds

com.typesafe.play.cachecontrol.Seconds
See theSeconds companion object
case class Seconds extends TemporalAmount

An immutable time period representing a number of seconds.

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait TemporalAmount
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

override 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.

Value parameters

temporal

the temporal object to adjust, not null

Attributes

Returns

an object of the same type with the adjustment made, not null

Throws
ArithmeticException

if numeric overflow occurs

DateTimeException

if unable to add

Definition Classes
TemporalAmount
override 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, [[ChronoUnit#SECONDS SECONDS]] and [[ChronoUnit#NANOS NANOS]]. All other units throw an exception.

Value parameters

unit

the { @code TemporalUnit} for which to return the value

Attributes

Returns

the long value of the unit

Throws
DateTimeException

if the unit is not supported

UnsupportedTemporalTypeException

if the unit is not supported

Definition Classes
TemporalAmount
override 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 [[ChronoUnit#SECONDS SECONDS]], and [[ChronoUnit#NANOS NANOS]]. 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.

Attributes

Returns

a list containing the seconds and nanos units, not null

Definition Classes
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.

Value parameters

other

the other period, null means zero

Attributes

Returns

true if this seconds instance is greater than the specified one

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.

Value parameters

other

the other period, null means zero

Attributes

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.

Value parameters

other

the amount of seconds to take away, may be negative, null means zero

Attributes

Returns

the new period minus the specified number of seconds

Throws
ArithmeticException

if the result overflows an int

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.

Value parameters

other

the amount of seconds to add, may be negative, null means zero

Attributes

Returns

the new period plus the specified number of seconds

Throws
ArithmeticException

if the result overflows an int

def seconds: Long

Gets the number of seconds that this period represents.

Gets the number of seconds that this period represents.

Attributes

Returns

the number of seconds in the period

override 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.

Value parameters

temporal

the temporal object to adjust, not null

Attributes

Returns

an object of the same type with the adjustment made, not null

Throws
ArithmeticException

if numeric overflow occurs

DateTimeException

if unable to subtract

Definition Classes
TemporalAmount
override 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.

Attributes

Returns

the value as an ISO8601 string

Definition Classes
Any

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product