public class TimestampConverter
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static long |
MAX_MICROS
The number of microseconds in a
Timestamp.MAX_VALUE . |
Constructor and Description |
---|
TimestampConverter() |
Modifier and Type | Method and Description |
---|---|
static com.google.cloud.Timestamp |
timestampFromMillis(long millis)
Creates a
Timestamp from a number of milliseconds. |
static long |
timestampToMicros(com.google.cloud.Timestamp timestamp)
Converts a
Timestamp to its number of microseconds. |
static com.google.cloud.Timestamp |
truncateNanos(com.google.cloud.Timestamp timestamp)
Zeroes nanoseconds from the given
Timestamp (precision is lost). |
public static final long MAX_MICROS
Timestamp.MAX_VALUE
.public static long timestampToMicros(com.google.cloud.Timestamp timestamp)
Timestamp
to its number of microseconds. Note there is precision loss here.timestamp
- the timestamp to be convertedpublic static com.google.cloud.Timestamp timestampFromMillis(long millis)
Timestamp
from a number of milliseconds. Note that microseconds and
nanoseconds will always be zeroed here.millis
- the number of millisecondspublic static com.google.cloud.Timestamp truncateNanos(com.google.cloud.Timestamp timestamp)
Timestamp
(precision is lost). The timestamp returned
will be precise up to microseconds only.timestamp
- the timestamp to be truncated