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

Function update

clock-bound/src/daemon/clock_sync_algorithm/selector.rs:238–265  ·  view source on GitHub ↗
(
        #[case] first: ClockParameters,
        #[case] second: event::Ntp,
        #[case] period: Period,
        #[case] max_dispersion: Skew,
        #[case] expected: bool,
    )

Source from the content-addressed store, hash-verified

236 false
237 )]
238 fn update(
239 #[case] first: ClockParameters,
240 #[case] second: event::Ntp,
241 #[case] period: Period,
242 #[case] max_dispersion: Skew,
243 #[case] expected: bool,
244 ) {
245 let val = ClockParameters {
246 tsc_count: second.tsc_midpoint(),
247 time: second
248 .data()
249 .server_recv_time
250 .midpoint(second.data().server_send_time),
251 clock_error_bound: second.calculate_clock_error_bound(period),
252 period,
253 period_max_error: Period::from_seconds(1e-11), // unused
254 as_of_monotonic: Instant::from_days(1), // unused
255 };
256 let mut selector = Selector {
257 current: Some(SourceParams {
258 clock_parameters: first,
259 source_info: SourceInfo::Phc,
260 }),
261 max_dispersion_growth: max_dispersion,
262 };
263 let result = selector.update(&val, SourceInfo::Phc).is_some();
264 assert_eq!(result, expected);
265 }
266
267 #[test]
268 fn first_update_sets_current() {

Callers

nothing calls this directly

Calls 5

tsc_midpointMethod · 0.80
midpointMethod · 0.80
updateMethod · 0.80
dataMethod · 0.45

Tested by

no test coverage detected