Class PositiveTimestamp


  • public class PositiveTimestamp
    extends Object
    A timestamp that refers to a date after 1 January 1970 which means its representation as UNIX timestamp is positive. # Invariants The UNIX timestamp representing the stored time has to be positive and small enough so that a `EpiryTime` can be added to it without an overflow.
    • Method Detail

      • 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.
      • from_unix_timestamp

        public static Result_PositiveTimestampCreationErrorZ from_unix_timestamp​(long unix_seconds)
        Create a new `PositiveTimestamp` from a unix timestamp in the Range `0...SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME`, otherwise return a `CreationError::TimestampOutOfBounds`.
      • from_system_time

        public static Result_PositiveTimestampCreationErrorZ from_system_time​(long time)
        Create a new `PositiveTimestamp` from a `SystemTime` with a corresponding unix timestamp in the Range `0...SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME`, otherwise return a `CreationError::TimestampOutOfBounds`.
      • as_unix_timestamp

        public long as_unix_timestamp()
        Returns the UNIX timestamp representing the stored time
      • as_time

        public long as_time()
        Returns a reference to the internal `SystemTime` time representation