public interface Instant extends org.apache.logging.log4j.util.StringBuilderFormattable
Provides methods for obtaining high precision time information similar to the Instant class introduced in Java 8, while also supporting the legacy millisecond precision API.
Depending on the platform, time sources (Clock
implementations) may produce high precision or millisecond
precision time values. At the same time, some time value consumers (for example timestamp formatters) may only be
able to consume time values of millisecond precision, while some others may require a high precision time value.
This class bridges these two time APIs.
Modifier and Type | Method and Description |
---|---|
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.
|
long getEpochSecond()
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 getNanoOfSecond()
.
int getNanoOfSecond()
The nanosecond-of-second value measures the total number of nanoseconds from the second returned by getEpochSecond()
.
999,999,999
long getEpochMillisecond()
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 getNanoOfMillisecond()
.
int getNanoOfMillisecond()
The nanosecond-of-millisecond value measures the total number of nanoseconds from the millisecond returned by getEpochMillisecond()
.
999,999
Copyright © 1999-2020 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.