doris_rs/record/
clock.rs

1#[cfg(doc)]
2use crate::prelude::{GroundStation, TimeScale, DORIS};
3
4use crate::prelude::Duration;
5
6#[cfg(feature = "serde")]
7use serde::{Deserialize, Serialize};
8
9#[derive(Clone, Copy, Debug, Default, PartialEq, PartialOrd, Eq, Ord, Hash)]
10#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
11pub struct ClockOffset {
12    /// True if this [ClockOffset] is actually extrapolated
13    /// and not actually measured.
14    pub extrapolated: bool,
15
16    /// Offset to [TimeScale::TAI] timescale, as [Duration]
17    pub offset: Duration,
18}
19
20impl ClockOffset {
21    /// Creates new [ClockOffset] from measured offset.
22    pub fn from_measured_offset(offset: Duration) -> Self {
23        Self {
24            offset,
25            extrapolated: false,
26        }
27    }
28
29    /// Creates new [ClockOffset] from extrapolated offset
30    /// (not actually measured).
31    pub fn from_extrapolated_offset(offset: Duration) -> Self {
32        Self {
33            offset,
34            extrapolated: true,
35        }
36    }
37}