Class Timestamp

java.lang.Object
com.daml.ledger.javaapi.data.Value
com.daml.ledger.javaapi.data.Timestamp

public final class Timestamp extends Value
A Timestamp value is represented as microseconds since the UNIX epoch.
See Also:
  • Constructor Details

    • Timestamp

      public Timestamp(long value)
      Constructs a Timestamp from a microsecond value.
      Parameters:
      value - The number of microseconds since UNIX epoch.
  • Method Details

    • fromMillis

      public static @NonNull Timestamp fromMillis(long millis)
      Constructs a Timestamp from milliseconds since UNIX epoch.
      Parameters:
      millis - milliseconds since UNIX epoch.
    • fromInstant

      public static @NonNull Timestamp fromInstant(@NonNull Instant instant)
      Constructs a Timestamp value from an Instant up to microsecond precision. This is a lossy conversion as nanoseconds are not preserved.
    • getValue

      public @NonNull Instant getValue()
      This is an alias for toInstant()
      Returns:
      the microseconds stored in this timestamp
    • getMicroseconds

      public @org.checkerframework.checker.nullness.qual.NonNull long getMicroseconds()
    • toInstant

      public Instant toInstant()
      Returns:
      The point in time represented by this timestamp as Instant.
    • toProto

      public ValueOuterClass.Value toProto()
      Specified by:
      toProto in class Value
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object