Skip to main content

stamps

Function stamps 

pub fn stamps(now: Instant, broker: Option<&Timestamp>) -> Timestamps
Expand description

Reception timestamps with the broker time attached when the message has one.

now is the instant the message was received. A missing broker time, or one that is exactly zero, is left out.

§Examples

use std::time::Instant;
use brokapi_tbank::ids::stamps;
use prost_types::Timestamp;

assert!(stamps(Instant::now(), None).broker_ts.is_none());
let t = stamps(Instant::now(), Some(&Timestamp { seconds: 5, nanos: 0 }));
assert!(t.broker_ts.is_some());