pub struct Timestamp(/* private fields */);Expand description
An instant in UTC, serialized as an RFC 3339 string with a zero offset.
Implementations§
Source§impl Timestamp
impl Timestamp
Sourcepub fn pass_replay_time(wait: Duration) -> bool
pub fn pass_replay_time(wait: Duration) -> bool
Let wait pass on the real-print replay’s clock rather than in real
time, and answer whether it did.
Only a build of the suite’s own, under the replay-clock feature, with
its clock file beside the program, answers true: every other build
answers false and the caller waits as it always does. A caller asks
only when nothing could end its wait early, so passing the wait at once
moves every reading of the clock exactly as waiting it out would.
Sourcepub fn on_replay_clock(steady: Duration) -> Duration
pub fn on_replay_clock(steady: Duration) -> Duration
A span measured on the host’s steady clock, as the real-print replay’s clock would measure it.
The replay jumps its clock from one recorded event to the next, minutes or
hours apart, in a few seconds of real time, so the agent’s minimum interval,
measured across a jump, has to count the jump too, or the agent’s change at
the second of two recorded events an hour apart reads as seconds after its
change at the first. Only a build of the suite’s own, under
the replay-clock feature, with its clock file beside the program, adds
anything: every other build answers steady unchanged. The answer never
goes back, because a steady clock never does.
Sourcepub fn from_unix_seconds(seconds: i64) -> Result<Self, TimestampError>
pub fn from_unix_seconds(seconds: i64) -> Result<Self, TimestampError>
The instant this many seconds after the Unix epoch.
§Errors
Returns an error when the count of seconds denotes no representable instant.
Sourcepub fn plus_seconds(self, seconds: i64) -> Result<Self, TimestampError>
pub fn plus_seconds(self, seconds: i64) -> Result<Self, TimestampError>
The instant this many seconds after this one.
Sub-second precision is kept rather than dropped: an adjustment asked to stand for a minute stands for a minute, rather than for a minute less however far into a second it happened to be made.
§Errors
Returns an error when the result is not a representable instant.
Sourcepub fn latest() -> Self
pub fn latest() -> Self
The latest instant this type writes as a string it reads back.
The last moment of the year 9999: RFC 3339 spells a year in four digits, so a later instant is written with a sign and more digits that no RFC 3339 reader accepts — and that a store ordering instants by their text would order before every earlier one. Reading what is due by this instant reads everything due at any instant this type can record.
§Panics
Never: the instant is a fixed one every chrono represents.
Trait Implementations§
impl Copy for Timestamp
Source§impl<'de> Deserialize<'de> for Timestamp
impl<'de> Deserialize<'de> for Timestamp
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
impl Eq for Timestamp
Source§impl JsonSchema for Timestamp
impl JsonSchema for Timestamp
Source§fn json_schema(_generator: &mut SchemaGenerator) -> Schema
fn json_schema(_generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more