From 440b968af028535e2f47a0c0e14124874f318576 Mon Sep 17 00:00:00 2001 From: "Guillaume W. Bres" Date: Mon, 18 Sep 2023 20:23:32 +0200 Subject: [PATCH] fix epoch parsing Signed-off-by: Guillaume W. Bres --- rinex/src/navigation/stomessage.rs | 2 +- rinex/src/tests/nav.rs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/rinex/src/navigation/stomessage.rs b/rinex/src/navigation/stomessage.rs index 39a859657..cc20f6126 100644 --- a/rinex/src/navigation/stomessage.rs +++ b/rinex/src/navigation/stomessage.rs @@ -37,7 +37,7 @@ impl StoMessage { let (epoch, rem) = line.split_at(23); let (system, _) = rem.split_at(5); - let (epoch, _) = epoch::parse_utc(epoch.trim())?; + let (epoch, _) = epoch::parse_in_timescale(epoch.trim(), ts)?; let line = match lines.next() { Some(l) => l, diff --git a/rinex/src/tests/nav.rs b/rinex/src/tests/nav.rs index 7a3c70b87..3ac205f93 100644 --- a/rinex/src/tests/nav.rs +++ b/rinex/src/tests/nav.rs @@ -503,7 +503,7 @@ mod test { // test last epoch assert_eq!( rinex.last_epoch(), - Some(Epoch::from_str("2022-06-10T19:56:48 UTC").unwrap()), + Some(Epoch::from_str("2022-06-10T19:56:48 GPST").unwrap()), "wrong last epoch", ); @@ -884,8 +884,8 @@ mod test { ion_count += 1; // ION test let (_msg, _sv, model) = fr; if let Some(model) = model.as_klobuchar() { - let e0 = Epoch::from_gregorian_utc(2022, 06, 08, 09, 59, 48, 0); - let e1 = Epoch::from_gregorian_utc(2022, 06, 08, 09, 59, 50, 0); + let e0 = Epoch::from_str("2022-06-08T09:59:48 GPST").unwrap(); + let e1 = Epoch::from_str("2022-06-08T09:59:50 BDT").unwrap(); if *e == e0 { assert_eq!( model.alpha, @@ -925,11 +925,11 @@ mod test { ) ); } else { - panic!("misplaced ION message") + panic!("misplaced ION message {:?} @ {}", model, e) } assert_eq!(model.region, KbRegionCode::WideArea); } else if let Some(model) = model.as_nequick_g() { - assert_eq!(*e, Epoch::from_gregorian_utc(2022, 06, 08, 09, 59, 57, 00)); + assert_eq!(*e, Epoch::from_str("2022-06-08T09:59:57 GST").unwrap()); assert_eq!(model.region, NgRegionFlags::empty()); } }