MCPcopy Create free account
hub / github.com/aws/clock-bound / feed

Method feed

clock-bound/src/daemon/clock_sync_algorithm.rs:69–101  ·  view source on GitHub ↗

Feed the clock sync algorithm with a time synchronization event

(&mut self, routable_event: RoutableEvent)

Source from the content-addressed store, hash-verified

67
68 /// Feed the clock sync algorithm with a time synchronization event
69 pub fn feed(&mut self, routable_event: RoutableEvent) -> Option<&ClockParameters> {
70 #[cfg(not(test))]
71 {
72 use crate::daemon::event::TscRtt;
73 let Some(system_clock) = routable_event.system_clock() else {
74 return self.feed_repro(routable_event);
75 };
76 let system = system_clock.system_time;
77 let system_tsc = system_clock.tsc;
78 let tsc_rtt = routable_event.rtt();
79 let retval = self.feed_repro(routable_event);
80 if let Some(new_params) = &retval {
81 let system_clock_tsc_age = system_tsc - new_params.tsc_count;
82 let system_clock_age = system_clock_tsc_age * new_params.period;
83
84 let comparable_time = new_params.time + system_clock_age;
85 let offset_from_system_clock = comparable_time - system;
86 let ntp_rtt = tsc_rtt * new_params.period;
87
88 tracing::info!(
89 ?system_clock_tsc_age,
90 ?offset_from_system_clock,
91 ?ntp_rtt,
92 ?tsc_rtt
93 );
94 }
95 retval
96 }
97 #[cfg(test)]
98 {
99 self.feed_repro(routable_event)
100 }
101 }
102
103 /// Get the current best clock parameters
104 pub fn clock_parameters(&self) -> Option<&ClockParameters> {

Callers 10

handle_eventMethod · 0.45
feed_link_localMethod · 0.45
feed_ntp_sourceMethod · 0.45
feed_phcMethod · 0.45
feed_serializes_eventsFunction · 0.45
runMethod · 0.45
feed_ntpMethod · 0.45
runMethod · 0.45
feed_phcMethod · 0.45
mainFunction · 0.45

Calls 3

feed_reproMethod · 0.80
system_clockMethod · 0.45
rttMethod · 0.45

Tested by

no test coverage detected