statime/observability/
current.rsuse crate::{datastructures::datasets::InternalCurrentDS, filters::FilterEstimate, time::Duration};
#[derive(Debug, Default, Copy, Clone)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct CurrentDS {
pub steps_removed: u16,
pub offset_from_master: Duration,
pub mean_delay: Duration,
}
impl CurrentDS {
pub(crate) fn from_state(
current_ds: &InternalCurrentDS,
port_contribution: Option<FilterEstimate>,
) -> Self {
match port_contribution {
Some(port_contribution) => Self {
steps_removed: current_ds.steps_removed,
offset_from_master: port_contribution.offset_from_master,
mean_delay: port_contribution.mean_delay,
},
None => Self {
steps_removed: current_ds.steps_removed,
offset_from_master: Duration::ZERO,
mean_delay: Duration::ZERO,
},
}
}
}