Skip to main content

SyncController

Struct SyncController 

Source
pub struct SyncController { /* private fields */ }
Expand description

One source driving one clock — the single-source case, and the type the simulator and every existing caller use.

A thin facade over MultiController with exactly one register, so there is one implementation of the loop rather than two that can drift apart.

Implementations§

Source§

impl SyncController

Source

pub fn new(config: DisciplineConfig) -> Self

Source

pub fn on_sample(&mut self, mono_now_s: f64, sample: Sample) -> ControllerStep

Feed one completed exchange and get the resulting plan.

mono_now_s is the local monotonic clock; sample.t should be the exchange midpoint on that same timescale.

Source

pub fn on_sample_with_leap( &mut self, mono_now_s: f64, sample: Sample, leap_pending: bool, ) -> ControllerStep

As SyncController::on_sample, told whether the source has announced a leap second for the current UTC day.

Source

pub fn revert_last_plan(&mut self) -> bool

Source

pub fn confirm_last_plan(&mut self)

Source

pub fn freq_ppm(&self) -> f64

Source

pub fn drain_ppm(&self) -> f64

Source

pub fn applied_ppm(&self) -> f64

Source

pub fn poll_log2(&self) -> i8

Source

pub fn samples(&self) -> usize

Source

pub fn preload_frequency(&mut self, freq_ppm: f64)

Source

pub fn retry_interval_s(&self) -> f64

Source

pub fn drain_completes_at(&self) -> Option<f64>

Source

pub fn poll_drain(&mut self, mono_now_s: f64) -> Option<ClockCommand>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.