public class TimestampUtils
extends java.lang.Object
| Constructor and Description |
|---|
TimestampUtils() |
| Modifier and Type | Method and Description |
|---|---|
static com.google.cloud.Timestamp |
next(com.google.cloud.Timestamp timestamp)
Adds one nanosecond to the given timestamp.
|
static com.google.cloud.Timestamp |
previous(com.google.cloud.Timestamp timestamp) |
static java.math.BigDecimal |
toNanos(com.google.cloud.Timestamp timestamp)
Converts the given timestamp to respective nanoseconds representation.
|
static com.google.cloud.Timestamp |
toTimestamp(java.math.BigDecimal bigDecimal)
Converts nanoseconds to their respective timestamp.
|
public static java.math.BigDecimal toNanos(com.google.cloud.Timestamp timestamp)
Since the seconds part of a timestamp can be negative (if the timestamp represents a date
earlier than 1970-01-01), seconds are shifted by Timestamp.MIN_VALUE seconds by adding
the absolute value.
timestamp - the timestamp to be convertedTimestamp.MIN_VALUEpublic static com.google.cloud.Timestamp toTimestamp(java.math.BigDecimal bigDecimal)
Timestamp.MIN_VALUE. Thus, when converting,
they are shifted back to 1970-01-01, by subtracting the given seconds by the absolute value of
seconds from Timestamp.MIN_VALUE.bigDecimal - the nanoseconds representation of a timestamp (from Timestamp.MIN_VALUE)public static com.google.cloud.Timestamp next(com.google.cloud.Timestamp timestamp)
Timestamp.MAX_VALUE, Timestamp.MAX_VALUE is returned.timestamp - the timestamp to have one nanosecond added topublic static com.google.cloud.Timestamp previous(com.google.cloud.Timestamp timestamp)