statime/observability/
current.rs1use crate::{datastructures::datasets::InternalCurrentDS, filters::FilterEstimate, time::Duration};
2
3#[derive(Debug, Default, Copy, Clone)]
9#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
10pub struct CurrentDS {
11 pub steps_removed: u16,
13 pub offset_from_master: Duration,
15 pub mean_delay: Duration,
17}
18
19impl CurrentDS {
20 pub(crate) fn from_state(
21 current_ds: &InternalCurrentDS,
22 port_contribution: Option<FilterEstimate>,
23 ) -> Self {
24 match port_contribution {
25 Some(port_contribution) => Self {
26 steps_removed: current_ds.steps_removed,
27 offset_from_master: port_contribution.offset_from_master,
28 mean_delay: port_contribution.mean_delay,
29 },
30 None => Self {
31 steps_removed: current_ds.steps_removed,
32 offset_from_master: Duration::ZERO,
33 mean_delay: Duration::ZERO,
34 },
35 }
36 }
37}