Skip to main content

observe_publish_stamp

Function observe_publish_stamp 

Source
pub fn observe_publish_stamp(
    cell: &PubMonitorCell,
    raw: &[u8],
    offset: usize,
    now_us: u64,
)
Expand description

Peek Time { i32 sec; u32 nanosec } little-endian at offset in a raw CDR receive buffer (encapsulation header included) and return µs since the UNIX epoch. None when the buffer is too short or the stamp is pre-epoch/zero (unstamped messages never fire age monitors). Record the age of the stamp a publisher just put on the wire.

Called from the publish path with the encoded CDR still in hand, using the same STAMP_OFFSET peek the take path uses. A no-op when the type carries no stamp, when no epoch source is installed, or when the publisher is uncontracted – the same three ways observe_age folds away.

Stores rather than accumulates: this is “how old was the last thing published”, a state, not a window maximum. A chain check wants the current value, and a max would be pinned forever by one stale message at startup.