In Instant
there are methods:
toEpochMilli
which converts this instant to the number of milliseconds from the epoch of 1970-01-01T00:00:00ZgetEpochSecond
which gets the number of seconds from the Java epoch of 1970-01-01T00:00:00Z.
Both of these methods lose precision, e.g. in toEpochMilli
JavaDoc I see:
If this instant has greater than millisecond precision, then the conversion drop any excess precision information as though the amount in nanoseconds was subject to integer division by one million.
I don't see corresponding methods to obtain more precise timestamp. How can I get number of micros or nanos from epoch in Java 8?