#[non_exhaustive]pub struct Stamp {
pub arrived: Instant,
pub since_open: Duration,
pub box_time: Option<BoxTime>,
pub received: Instant,
pub received_since_open: Duration,
pub received_qpc: Option<i64>,
}Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.arrived: Instantthe best guess at when the event happened, on the PC’s clock. on Medius it’s the box clock mapped onto the
PC’s through the medius crate, which keeps it from ever going backwards and smooths it after bursts, so it’s
an estimate there and NOT when the PC got the event, use received for that
since_open: Durationthe same moment as the time since the device was opened, for code that can’t use Instant
box_time: Option<BoxTime>§received: Instantwhen anybox got the event. on MAKCU that’s right after the port read returned with the report’s last byte, on Medius it’s when anybox took it from the medius crate, which reads the port on its own thread, so it’s a bit after the read there. either way it’s the read and not the USB arrival, driver buffering and a backlog make it late, and reports that came in one read share it
received_since_open: Durationthe same moment as received, as the time since the device was opened
received_qpc: Option<i64>the raw QueryPerformanceCounter value at received, on Windows only, since an Instant can’t be turned
back into one and a USB capture stamps its packets in QPC
Implementations§
Source§impl Stamp
impl Stamp
Sourcepub fn new(arrived: Instant, since_open: Duration) -> Self
pub fn new(arrived: Instant, since_open: Duration) -> Self
for tests and for code that builds events itself. received starts out as arrived, and since_open
isn’t checked against arrived
pub fn with_box_time(self, box_time: BoxTime) -> Self
Sourcepub fn arrived_ns(&self) -> u64
pub fn arrived_ns(&self) -> u64
arrived in nanoseconds on the clock monotonic_ns reads, so it lines up with stamps from other devices
and other programs on this machine
Sourcepub fn received_ns(&self) -> u64
pub fn received_ns(&self) -> u64
received in nanoseconds on the clock monotonic_ns reads
Sourcepub fn with_received(self, received: Instant, qpc: Option<i64>) -> Self
pub fn with_received(self, received: Instant, qpc: Option<i64>) -> Self
received_since_open comes out of received and since_open, so set those right first