unix_now
The current time as whole seconds since the Unix epoch.
Import
Section titled “Import”Cargo feature time (enabled by default). To compile only this module:
or in Cargo.toml:
Signature
Section titled “Signature”Returns
Section titled “Returns”Result<u64, ClockError> — Ok on success, otherwise an Err: see Errors.
Errors
Section titled “Errors”ClockError when the system clock is set before 1970. Do not turn that into 0: a token
expiry checked against 0 would look valid forever.
Examples
Section titled “Examples”Error type: ClockError
Section titled “Error type: ClockError”The system clock is set before the Unix epoch (1970-01-01T00:00:00Z).
Returned instead of a silent 0: an expiry comparison against 0 would treat every token as
still valid.
ClockError::behind
Section titled “ClockError::behind”How far before the epoch the clock is.
Returns
Duration — How far in the past the system clock reported, relative to the Unix epoch.
