Skip to main content

Module time

Module time 

Source
Expand description

Time helpers shared between the runtime validator and code generated by prost-protovalidate-build.

The single public entry point now_systemtime returns the current wall-clock time as a prost_types::Timestamp. Generated Validate impls for messages with lt_now / gt_now / within timestamp rules call this directly — the trait signature fn validate(&self) -> … has no place to inject a now_fn, so the compile-time path always reads SystemTime::now(). This matches the runtime Validator’s default configuration, which uses the same SystemTime::now() source via ValidationConfig::now_fn.

Test determinism: for tests that need a deterministic now, use the runtime Validator with a now_fn override. The compile-time Validate::validate(&self) path cannot accept an injected now.

Functions§

now_systemtime
Current wall-clock time as a protobuf Timestamp.