Package dev.vortex
Class DateTimeUtil
java.lang.Object
dev.vortex.DateTimeUtil
Utility class for date and time conversions in Vortex.
This class provides helper functions for converting Java date/time objects to nanoseconds since the Unix epoch, which is the internal representation used by Vortex for temporal data.
Helpful functions borrowed from Iceberg class with same name.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final OffsetDateTime
The Unix epoch as an OffsetDateTime (1970-01-01T00:00:00Z). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic long
nanosFromTimestamp
(LocalDateTime dateTime) Converts a LocalDateTime to nanoseconds since the Unix epoch.static long
nanosFromTimestamptz
(OffsetDateTime dateTime) Converts an OffsetDateTime to nanoseconds since the Unix epoch.
-
Field Details
-
EPOCH
The Unix epoch as an OffsetDateTime (1970-01-01T00:00:00Z).
-
-
Constructor Details
-
DateTimeUtil
public DateTimeUtil()
-
-
Method Details
-
nanosFromTimestamp
Converts a LocalDateTime to nanoseconds since the Unix epoch.The LocalDateTime is assumed to be in UTC timezone for conversion purposes. When decoded back to LocalDateTime, the timezone information will not be preserved.
- Parameters:
dateTime
- the LocalDateTime to convert- Returns:
- nanoseconds since the Unix epoch
-
nanosFromTimestamptz
Converts an OffsetDateTime to nanoseconds since the Unix epoch.The timezone information in the OffsetDateTime is preserved during conversion.
- Parameters:
dateTime
- the OffsetDateTime to convert- Returns:
- nanoseconds since the Unix epoch
-