Expand description
Wall-clock time primitives — the small typed layer over the
chrono::DateTime<Utc> → std::time::Duration bridge every timed
decision in the workspace passes through, plus the K8s wire-form
composers (tombstone_now, tombstone_at) that lift a
DateTime<Utc> anchor into the Option<Time> shape
ObjectMeta::deletion_timestamp (and its metadata-Time peers)
carry.
Kubernetes exposes wall-clock anchors on the wire as
k8s_openapi::apimachinery::pkg::apis::meta::v1::Time
(DateTime<Utc> after .0) — metadata.creationTimestamp,
metadata.deletionTimestamp, status.phaseSince,
PoolMember.enteredStateAt, etc. Every timed decision (TTL
expiry, sleep-budget picker, staleness gate) then projects
(now, anchor) onto an Option<std::time::Duration> so it can
be compared to a humantime-parsed budget (also
std::time::Duration). This module owns the one-line chain that
projection reduces to on the READ side, and — via tombstone_now
and tombstone_at — the 5-token Some(Time(<anchor>)) wire
wrap every WRITE-side fixture that seeds a tombstone-present
corner stamps on the metadata slot.
Functions§
- at_
epoch_ second - A
DateTime<Utc>anchor at the whole-second Unix epoch offsetsecs— the one-lineDateTime::<Utc>::from_timestamp(secs, 0) .expect("valid epoch second")chain lifted to ONE typed owner past the ★★ PRIME-DIRECTIVE ≥ 2 duplication threshold, and the deterministic-anchor peer of the wall-clock-reading composersseconds_ago/tombstone_nowon the same→ DateTime<Utc>axis. - elapsed_
since - Elapsed wall-clock time between
anchorandnow, orNoneifanchoris innow’s future (a clock rewind or a mis-sequenced anchor). The one-linenow.signed_duration_since(anchor).to_std() .ok()chain lifted to ONE typed owner past the ★★ PRIME-DIRECTIVE ≥ 2 duplication threshold, and the peer of every timed-decision gate that compares an anchor to ahumantime-parsed budget. - parse_
rfc3339_ opt - Parse an
Option<&str>as an RFC-3339 wall-clock stamp, discarding theParseErrorarm on the parseable-input axis. The one-line<opt>.and_then(|s| chrono::DateTime::parse_from_rfc3339(s).ok())chain lifted to ONE typed owner past the ★★ PRIME-DIRECTIVE ≥ 2 duplication threshold, and the sibling of every timed-decision assertion / API-input parser that reads an RFC-3339 stamp out of a JSON slot, an HTTP query param, or a K8sstatus-subresource value. - seconds_
ago - A wall-clock anchor
secsseconds before the current instant — the one-lineUtc::now() - chrono::Duration::seconds(secs)chain lifted to ONE typed owner past the ★★ PRIME-DIRECTIVE ≥ 2 duplication threshold, and the composition partner of every timed-decision test (or production caller) that needs a “recently-past” anchor to feedelapsed_sinceor ahumantime-parsed budget comparator. - tombstone_
at - A tombstone stamp for a K8s
metadata.deletionTimestampslot at the operator-suppliedwhenanchor — the peer oftombstone_nowon the anchor-explicit axis. Composes directly withseconds_agoso a callsite needing a “stampedNseconds ago” tombstone (e.g. a stale-tombstone garbage-collection probe, a fixture that seeds a tombstone predating the reconciler’snowby enough to trip adeletion_grace_period_secondscutoff) readstombstone_at(seconds_ago(N))and routes through ONE substrate owner for both the anchor construction and the wire-form wrap. - tombstone_
now - A tombstone stamp for a K8s
metadata.deletionTimestampslot at the current wall-clock instant — the wire shape K8s stamps once the API server has received a DELETE request but the finalizer chain has not yet released the object for GC. TheOption<Time>return form matches the slot’s own type (ObjectMeta::deletion_timestamp: Option<Time>) so the tombstone composes directly into the metadata without a per-callerSome(...)wrap or a per-callerTime(...)wrap of theUtc::now()read.