public static class RichPresence.Timestamps
extends java.lang.Object
Constructor | Description |
---|---|
Timestamps(long start,
long end) |
Modifier and Type | Method | Description |
---|---|---|
boolean |
equals(java.lang.Object obj) |
|
long |
getElapsedTime(java.time.temporal.TemporalUnit unit) |
Calculates the elapsed time from
getStartTime() to now in terms of the specified unit. |
long |
getEnd() |
Epoch second timestamp of match end, or
0 of unset. |
java.time.Instant |
getEndTime() |
Shortcut for
Instant.ofEpochSecond(start) |
long |
getRemainingTime(java.time.temporal.TemporalUnit unit) |
Calculates the amount of time until
getEndTime() in terms of the specified unit. |
long |
getStart() |
Epoch second timestamp of match start, or
0 of unset. |
java.time.Instant |
getStartTime() |
Shortcut for
Instant.ofEpochSecond(start) |
int |
hashCode() |
|
java.lang.String |
toString() |
public long getStart()
0
of unset.0
of unset.@Nullable public java.time.Instant getStartTime()
Instant.ofEpochSecond(start)
null
if unsetpublic long getEnd()
0
of unset.0
of unset.@Nullable public java.time.Instant getEndTime()
Instant.ofEpochSecond(start)
null
if unsetpublic long getRemainingTime(java.time.temporal.TemporalUnit unit)
getEndTime()
in terms of the specified unit.
getEndTime()
is null
this will be negative.unit
- The TemporalUnit
to returnTemporalUnit
or -1
if unsetjava.lang.IllegalArgumentException
- If the provided unit is null
java.lang.ArithmeticException
- If a numeric overflow occursjava.time.DateTimeException
- If the amount cannot be calculatedjava.time.temporal.UnsupportedTemporalTypeException
- If the provided unit is not supportedInstant.until(Temporal, TemporalUnit)
,
TemporalUnit
public long getElapsedTime(java.time.temporal.TemporalUnit unit)
getStartTime()
to now in terms of the specified unit.
getStartTime()
is null
this will be negative.unit
- The TemporalUnit
to returnTemporalUnit
or -1
if unsetjava.lang.IllegalArgumentException
- If the provided unit is null
java.lang.ArithmeticException
- If a numeric overflow occursjava.time.DateTimeException
- If the amount cannot be calculatedjava.time.temporal.UnsupportedTemporalTypeException
- If the provided unit is not supportedInstant.until(Temporal, TemporalUnit)
,
TemporalUnit
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object