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 long
as_duration_since_epoch()
Returns the duration of the stored time since the Unix epochlong
as_time()
Returns the [`SystemTime`] representing the stored timelong
as_unix_timestamp()
Returns the Unix timestamp representing the stored timePositiveTimestamp
clone()
Creates a copy of the PositiveTimestampboolean
eq(PositiveTimestamp b)
Checks if two PositiveTimestamps contain equal inner contents.boolean
equals(Object o)
protected void
finalize()
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`.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`.static Result_PositiveTimestampCreationErrorZ
from_unix_timestamp(long unix_seconds)
Creates a `PositiveTimestamp` from a Unix timestamp in the range `0..=MAX_TIMESTAMP`.long
hash()
Generates a non-cryptographic 64-bit hash of the PositiveTimestamp.int
hashCode()
-
-
-
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
-
hash
public long hash()
Generates a non-cryptographic 64-bit hash 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`. Note that the subsecond part is dropped as it is not representable in BOLT 11 invoices. 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`. Note that the subsecond part is dropped as it is not representable in BOLT 11 invoices. 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
-
-