Skip to main content

now_systemtime

Function now_systemtime 

Source
pub fn now_systemtime() -> Timestamp
Expand description

Current wall-clock time as a protobuf Timestamp.

Reads std::time::SystemTime::now() once per call.

§Pre-epoch fallback

When the system clock is before the Unix epoch (extremely rare, typically indicating a misconfigured system), duration_since(UNIX_EPOCH) returns an error and this function falls back to the Unix epoch (seconds = 0, nanos = 0) rather than panicking. Validation results for timestamp.lt_now / timestamp.gt_now against pre-epoch timestamps on such systems will be inverted — a pre-epoch Timestamp (negative seconds) will compare as “before the (epoch-treated-as) now”, which matches reality only by accident. Use the runtime Validator with a NowFn override (ValidatorOption::NowFn or ValidationOption::NowFn) if you need defined behaviour on anomalous clocks.