Record Class Timetz

java.lang.Object
java.lang.Record
io.codemine.java.postgresql.codecs.Timetz
Record Components:
time - microseconds from midnight (0 to 86400000000)
zone - timezone offset in seconds with inverted sign per PostgreSQL convention: UTC+1 is stored as -3600

public record Timetz(long time, int zone) extends Record
PostgreSQL timetz type. Time of day with time zone.
  • Constructor Details

    • Timetz

      public Timetz(long time, int zone)
      Creates an instance of a Timetz record class.
      Parameters:
      time - the value for the time record component
      zone - the value for the zone record component
  • Method Details

    • of

      public static Timetz of(OffsetTime value)
      Creates a Timetz from a OffsetTime.

      PostgreSQL stores timetz with microsecond precision, so any nanoseconds beyond the first 6 digits are truncated.

    • toOffsetTime

      public OffsetTime toOffsetTime()
      Converts this Timetz to an OffsetTime.
    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • time

      public long time()
      Returns the value of the time record component.
      Returns:
      the value of the time record component
    • zone

      public int zone()
      Returns the value of the zone record component.
      Returns:
      the value of the zone record component