Package com.influxdb.v3.client.internal
Class NanosecondConverter
java.lang.Object
com.influxdb.v3.client.internal.NanosecondConverter
Nanosecond converter.
Utility class converting epoch nanoseconds to epoch with a given precision.
-
Method Summary
Modifier and TypeMethodDescriptionstatic BigInteger
convert
(Instant instant, WritePrecision precision) ConvertInstant
timestamp to a given precision.static BigInteger
convertToNanos
(Number timestamp, WritePrecision precision) Convert timestamp in a given precision to nanoseconds.static BigInteger
getTimestampNano
(Object value, org.apache.arrow.vector.types.pojo.Field field) Convert Long or LocalDateTime to timestamp nanosecond.
-
Method Details
-
convertToNanos
@Nullable public static BigInteger convertToNanos(@Nullable Number timestamp, WritePrecision precision) Convert timestamp in a given precision to nanoseconds.- Parameters:
timestamp
- epoch timestampprecision
- precision- Returns:
- epoch timestamp in precision, can be null
-
convert
ConvertInstant
timestamp to a given precision.- Parameters:
instant
- Instant timestampprecision
- precision- Returns:
- epoch timestamp in precision
-
getTimestampNano
@Nullable public static BigInteger getTimestampNano(@Nonnull Object value, @Nonnull org.apache.arrow.vector.types.pojo.Field field) Convert Long or LocalDateTime to timestamp nanosecond.- Parameters:
value
- the time in Long or LocalDateTimefield
- the arrow field metadata- Returns:
- the time in nanosecond
-