Class TimestampUtils

Object
io.delta.kernel.internal.util.TimestampUtils

public final class TimestampUtils extends Object
Utilities for timestamp conversions that avoid overflow issues.

Note: ChronoUnit.MICROS.between() internally computes (seconds * 1_000_000_000) / 1000, where the intermediate nanoseconds value overflows for timestamps beyond ~292 years from epoch. These methods compute seconds * 1_000_000 directly to avoid overflow.

  • Method Details

    • toEpochMicros

      public static long toEpochMicros(Instant instant)
      Converts an Instant to microseconds since epoch.
    • toEpochMicros

      public static long toEpochMicros(OffsetDateTime dateTime)
      Converts an OffsetDateTime to microseconds since epoch.
    • toEpochMicros

      public static long toEpochMicros(LocalDateTime dateTime)
      Converts a LocalDateTime (interpreted as UTC) to microseconds since epoch.