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 boolean
equals(java.lang.Object o)
static @NonNull Timestamp
fromInstant(@NonNull java.time.Instant instant)
Constructs aTimestamp
value from anInstant
up to microsecond precision.static @NonNull Timestamp
fromMillis(long millis)
Constructs aTimestamp
from milliseconds since UNIX epoch.@org.checkerframework.checker.nullness.qual.NonNull long
getMicroseconds()
@NonNull java.time.Instant
getValue()
This is an alias fortoInstant()
int
hashCode()
java.time.Instant
toInstant()
ValueOuterClass.Value
toProto()
java.lang.String
toString()
-
-
-
Constructor Detail
-
Timestamp
public Timestamp(long value)
Constructs aTimestamp
from a microsecond value.- Parameters:
value
- The number of microseconds since UNIX epoch.
-
-
Method Detail
-
fromMillis
public static @NonNull Timestamp fromMillis(long millis)
Constructs aTimestamp
from milliseconds since UNIX epoch.- Parameters:
millis
- milliseconds since UNIX epoch.
-
fromInstant
public static @NonNull Timestamp fromInstant(@NonNull java.time.Instant instant)
Constructs aTimestamp
value from anInstant
up 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:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-