Timestamp

public class Timestamp implements Comparable<Timestamp>

Data structure representing a unique timestamp.

Constructors

Timestamp

protected Timestamp(long time, byte[] clockId)

Methods

compareTo

public int compareTo(Timestamp o)

equals

public boolean equals(Object obj)

getClockId

public byte[] getClockId()
Returns:the unique identifier of the clock that created this Timestamp.

getTime

public long getTime()

Return the time as a 64-bit long, where:

  • The higher 32-bit represent the number of seconds since midnight, January 1, 1970 UTC
  • The lower 32-bit represent a fraction of 1 second.

WARNING: this time cannot be used with java.util.Date.Date(long). Rather use getTimeAsInstant().

Returns:the time as a 64-bits NTP time.

getTimeAsInstant

public Instant getTimeAsInstant()
Returns:the Timestamp’s creation time as a java.time.Instant.

hashCode

public int hashCode()

toString

public String toString()