Package com.daml.ledger.javaapi.data
Class Timestamp
- java.lang.Object
-
- com.daml.ledger.javaapi.data.Value
-
- com.daml.ledger.javaapi.data.Timestamp
-
public class Timestamp extends Value
A Timestamp value is represented as microseconds since the UNIX epoch.- See Also:
ValueOuterClass.Value.getTimestamp()
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)static @NonNull TimestampfromInstant(@NonNull java.time.Instant instant)Constructs aTimestampvalue from anInstantup to microsecond precision.static @NonNull TimestampfromMillis(long millis)Constructs aTimestampfrom milliseconds since UNIX epoch.@org.checkerframework.checker.nullness.qual.NonNull longgetMicroseconds()@NonNull java.time.InstantgetValue()This is an alias fortoInstant()inthashCode()java.time.InstanttoInstant()ValueOuterClass.ValuetoProto()java.lang.StringtoString()
-
-
-
Constructor Detail
-
Timestamp
public Timestamp(long value)
Constructs aTimestampfrom a microsecond value.- Parameters:
value- The number of microseconds since UNIX epoch.
-
-
Method Detail
-
fromMillis
public static @NonNull Timestamp fromMillis(long millis)
Constructs aTimestampfrom milliseconds since UNIX epoch.- Parameters:
millis- milliseconds since UNIX epoch.
-
fromInstant
public static @NonNull Timestamp fromInstant(@NonNull java.time.Instant instant)
Constructs aTimestampvalue from anInstantup to microsecond precision. This is a lossy conversion as nanoseconds are not preserved.
-
getValue
public @NonNull java.time.Instant getValue()
This is an alias fortoInstant()- Returns:
- the microseconds stored in this timestamp
-
getMicroseconds
public @org.checkerframework.checker.nullness.qual.NonNull long getMicroseconds()
-
toInstant
public java.time.Instant toInstant()
- Returns:
- The point in time represented by this timestamp as
Instant.
-
toProto
public ValueOuterClass.Value toProto()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-