public class MutableInstant extends Object implements Instant, Serializable
Instances of this class are not thread-safe and should not be shared between threads.
Constructor and Description |
---|
MutableInstant() |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object object) |
void |
formatTo(StringBuilder buffer) |
long |
getEpochMillisecond()
Gets the number of milliseconds from the Java epoch of 1970-01-01T00:00:00Z.
|
long |
getEpochSecond()
Gets the number of seconds from the Java epoch of 1970-01-01T00:00:00Z.
|
int |
getNanoOfMillisecond()
Gets the number of nanoseconds, later along the time-line, from the start of the millisecond.
|
int |
getNanoOfSecond()
Gets the number of nanoseconds, later along the time-line, from the start of the second.
|
int |
hashCode() |
void |
initFrom(Clock clock) |
void |
initFrom(Instant other) |
void |
initFromEpochMilli(long epochMilli,
int nanoOfMillisecond)
Updates the fields of this
MutableInstant from the specified epoch millis. |
void |
initFromEpochSecond(long epochSecond,
int nano)
Updates the fields of this
MutableInstant from the specified instant components. |
static void |
instantToMillisAndNanos(long epochSecond,
int nano,
long[] result)
Updates the elements of the specified
long[] result array from the specified instant components. |
String |
toString() |
public MutableInstant()
public long getEpochSecond()
Instant
The epoch second count is a simple incrementing count of seconds where second 0 is 1970-01-01T00:00:00Z.
The nanosecond part of the day is returned by Instant.getNanoOfSecond()
.
getEpochSecond
in interface Instant
public int getNanoOfSecond()
Instant
The nanosecond-of-second value measures the total number of nanoseconds from the second returned by Instant.getEpochSecond()
.
getNanoOfSecond
in interface Instant
999,999,999
public long getEpochMillisecond()
Instant
The epoch millisecond count is a simple incrementing count of milliseconds where millisecond 0 is 1970-01-01T00:00:00Z.
The nanosecond part of the day is returned by Instant.getNanoOfMillisecond()
.
getEpochMillisecond
in interface Instant
public int getNanoOfMillisecond()
Instant
The nanosecond-of-millisecond value measures the total number of nanoseconds from the millisecond returned by Instant.getEpochMillisecond()
.
getNanoOfMillisecond
in interface Instant
999,999
public void initFromEpochMilli(long epochMilli, int nanoOfMillisecond)
MutableInstant
from the specified epoch millis.epochMilli
- the number of milliseconds from the Java epoch of 1970-01-01T00:00:00ZnanoOfMillisecond
- the number of nanoseconds, later along the time-line, from the start of the millisecondpublic void initFromEpochSecond(long epochSecond, int nano)
MutableInstant
from the specified instant components.epochSecond
- the number of seconds from the Java epoch of 1970-01-01T00:00:00Znano
- the number of nanoseconds, later along the time-line, from the start of the secondpublic static void instantToMillisAndNanos(long epochSecond, int nano, long[] result)
long[]
result array from the specified instant components.epochSecond
- (input) the number of seconds from the Java epoch of 1970-01-01T00:00:00Znano
- (input) the number of nanoseconds, later along the time-line, from the start of the secondresult
- (output) a two-element array to store the result: the first element is the number of milliseconds
from the Java epoch of 1970-01-01T00:00:00Z,
the second element is the number of nanoseconds, later along the time-line, from the start of the millisecondpublic void formatTo(StringBuilder buffer)
formatTo
in interface org.apache.logging.log4j.util.StringBuilderFormattable
Copyright © 1999-2021 The Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.