MCPcopy Create free account
hub / github.com/chirpstack/chirpstack / test_get_rx_timestamp_drift

Function test_get_rx_timestamp_drift

chirpstack/src/uplink/helpers.rs:206–224  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

204
205 #[test]
206 fn test_get_rx_timestamp_drift() {
207 let now = Utc::now() - chrono::Duration::seconds(60);
208 let rx_info = gw::UplinkRxInfo {
209 gw_time: Some(now.try_into().unwrap()),
210 ..Default::default()
211 };
212
213 let res: DateTime<Utc> = get_rx_timestamp(&[rx_info]).into();
214 assert_ne!(res, now);
215
216 let now = Utc::now() + chrono::Duration::seconds(60);
217 let rx_info = gw::UplinkRxInfo {
218 gw_time: Some(now.try_into().unwrap()),
219 ..Default::default()
220 };
221
222 let res: DateTime<Utc> = get_rx_timestamp(&[rx_info]).into();
223 assert_ne!(res, now);
224 }
225
226 #[test]
227 fn test_get_rx_timestamp_chrono_no_drift() {

Callers

nothing calls this directly

Calls 3

get_rx_timestampFunction · 0.85
unwrapMethod · 0.80
intoMethod · 0.45

Tested by

no test coverage detected