Package org.ldk.structs
Class PositiveTimestamp
- java.lang.Object
-
- org.ldk.structs.PositiveTimestamp
-
public class PositiveTimestamp extends Object
A timestamp that refers to a date after 1 January 1970. # Invariants The Unix timestamp representing the stored time has to be positive and no greater than [`MAX_TIMESTAMP`].
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description longas_duration_since_epoch()Returns the duration of the stored time since the Unix epochlongas_time()Returns the [`SystemTime`] representing the stored timelongas_unix_timestamp()Returns the Unix timestamp representing the stored timePositiveTimestampclone()Creates a copy of the PositiveTimestampbooleaneq(PositiveTimestamp b)Checks if two PositiveTimestamps contain equal inner contents.booleanequals(Object o)protected voidfinalize()static Result_PositiveTimestampCreationErrorZfrom_duration_since_epoch(long duration)Creates a `PositiveTimestamp` from a [`Duration`] since the Unix epoch in the range `0..=MAX_TIMESTAMP`.static Result_PositiveTimestampCreationErrorZfrom_system_time(long time)Creates a `PositiveTimestamp` from a [`SystemTime`] with a corresponding Unix timestamp in the range `0..=MAX_TIMESTAMP`.static Result_PositiveTimestampCreationErrorZfrom_unix_timestamp(long unix_seconds)Creates a `PositiveTimestamp` from a Unix timestamp in the range `0..=MAX_TIMESTAMP`.
-
-
-
Method Detail
-
finalize
protected void finalize() throws Throwable
-
eq
public boolean eq(PositiveTimestamp b)
Checks if two PositiveTimestamps contain equal inner contents. This ignores pointers and is_owned flags and looks at the values in fields. Two objects with NULL inner values will be considered "equal" here.
-
clone
public PositiveTimestamp clone()
Creates a copy of the PositiveTimestamp
-
from_unix_timestamp
public static Result_PositiveTimestampCreationErrorZ from_unix_timestamp(long unix_seconds)
Creates a `PositiveTimestamp` from a Unix timestamp in the range `0..=MAX_TIMESTAMP`. Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
-
from_system_time
public static Result_PositiveTimestampCreationErrorZ from_system_time(long time)
Creates a `PositiveTimestamp` from a [`SystemTime`] with a corresponding Unix timestamp in the range `0..=MAX_TIMESTAMP`. Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
-
from_duration_since_epoch
public static Result_PositiveTimestampCreationErrorZ from_duration_since_epoch(long duration)
Creates a `PositiveTimestamp` from a [`Duration`] since the Unix epoch in the range `0..=MAX_TIMESTAMP`. Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
-
as_unix_timestamp
public long as_unix_timestamp()
Returns the Unix timestamp representing the stored time
-
as_duration_since_epoch
public long as_duration_since_epoch()
Returns the duration of the stored time since the Unix epoch
-
as_time
public long as_time()
Returns the [`SystemTime`] representing the stored time
-
-