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

Function phc_stream

clock-bound/src/daemon/receiver_stream.rs:239–266  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

237
238 #[tokio::test]
239 async fn phc_stream() {
240 let (_link_local_tx, link_local_rx) = create(1);
241 let (phc_tx, phc_rx) = create(1);
242
243 let mut rx_stream = ReceiverStream::builder()
244 .link_local(link_local_rx)
245 .phc(phc_rx)
246 .build();
247
248 let phc_data = event::Phc::builder()
249 .tsc_pre(TscCount::new(1))
250 .tsc_post(TscCount::new(2))
251 .data(PhcData {
252 clock_error_bound: Duration::from_micros(20),
253 time: Instant::from_days(3),
254 })
255 .build()
256 .unwrap();
257
258 phc_tx.send(phc_data.clone()).unwrap();
259
260 let result = rx_stream.recv().await.unwrap();
261 let RoutableEvent::Phc(data) = &result else {
262 panic!("Expected to receive a Phc event, got {result:?}")
263 };
264
265 assert_eq!(*data, phc_data);
266 }
267
268 #[test]
269 fn add_ntp_source() {

Callers

nothing calls this directly

Calls 9

createFunction · 0.85
sendMethod · 0.80
newFunction · 0.50
buildMethod · 0.45
phcMethod · 0.45
dataMethod · 0.45
tsc_postMethod · 0.45
tsc_preMethod · 0.45
recvMethod · 0.45

Tested by

no test coverage detected