Package net.dv8tion.jda.api.entities
Class Activity.Timestamps
- java.lang.Object
-
- net.dv8tion.jda.api.entities.Activity.Timestamps
-
-
Constructor Summary
Constructors Constructor Description Timestamps(long start, long end)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
long
getElapsedTime(TemporalUnit unit)
Calculates the elapsed time fromgetStartTime()
to now in terms of the specified unit.long
getEnd()
Epoch second timestamp of match end, or0
of unset.Instant
getEndTime()
Shortcut forInstant.ofEpochSecond(start)
long
getRemainingTime(TemporalUnit unit)
Calculates the amount of time untilgetEndTime()
in terms of the specified unit.long
getStart()
Epoch second timestamp of match start, or0
of unset.Instant
getStartTime()
Shortcut forInstant.ofEpochSecond(start)
int
hashCode()
String
toString()
-
-
-
Method Detail
-
getStart
public long getStart()
Epoch second timestamp of match start, or0
of unset.- Returns:
- Epoch second timestamp of match start, or
0
of unset.
-
getStartTime
@Nullable public Instant getStartTime()
Shortcut forInstant.ofEpochSecond(start)
- Returns:
- Instant of match start, or
null
if unset
-
getEnd
public long getEnd()
Epoch second timestamp of match end, or0
of unset.- Returns:
- Epoch second timestamp of match end, or
0
of unset.
-
getEndTime
@Nullable public Instant getEndTime()
Shortcut forInstant.ofEpochSecond(start)
- Returns:
- Instant of match start, or
null
if unset
-
getRemainingTime
public long getRemainingTime(TemporalUnit unit)
Calculates the amount of time untilgetEndTime()
in terms of the specified unit.
IfgetEndTime()
isnull
this will be negative.- Parameters:
unit
- TheTemporalUnit
to return- Returns:
- Remaining time in the provided
TemporalUnit
or-1
if unset - Throws:
IllegalArgumentException
- If the provided unit isnull
ArithmeticException
- If a numeric overflow occursDateTimeException
- If the amount cannot be calculatedUnsupportedTemporalTypeException
- If the provided unit is not supported- See Also:
Instant.until(Temporal, TemporalUnit)
,TemporalUnit
-
getElapsedTime
public long getElapsedTime(TemporalUnit unit)
Calculates the elapsed time fromgetStartTime()
to now in terms of the specified unit.
IfgetStartTime()
isnull
this will be negative.- Parameters:
unit
- TheTemporalUnit
to return- Returns:
- Elapsed time in the provided
TemporalUnit
or-1
if unset - Throws:
IllegalArgumentException
- If the provided unit isnull
ArithmeticException
- If a numeric overflow occursDateTimeException
- If the amount cannot be calculatedUnsupportedTemporalTypeException
- If the provided unit is not supported- See Also:
Instant.until(Temporal, TemporalUnit)
,TemporalUnit
-
-