Skip to content

Commit

Permalink
Merge pull request #171 from gwbres/timescale
Browse files Browse the repository at this point in the history
timescale: identify GNSS timescales from standard 3 letter codes
  • Loading branch information
ChristopherRabotin authored Nov 15, 2022
2 parents ed2090d + 0917f97 commit e44444e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/timescale.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,11 @@ impl FromStr for TimeScale {
Ok(Self::TDB)
} else if val == "ET" {
Ok(Self::ET)
} else if val == "GPST" {
} else if val == "GPST" || val == "GPS" {
Ok(Self::GPST)
} else if val == "GST" {
} else if val == "GST" || val == "GAL" {
Ok(Self::GST)
} else if val == "BDT" {
} else if val == "BDT" || val == "BDS" {
Ok(Self::BDT)
} else {
Err(Errors::ParseError(ParsingErrors::TimeSystem))
Expand Down
11 changes: 11 additions & 0 deletions tests/timescale.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@ fn test_from_str() {
}
}

#[test]
fn test_from_rinex_format() {
/*
* Test (GNSS) timescales identification
* from standard 3 letter constellation code
*/
assert_eq!(TimeScale::from_str("GPS"), Ok(TimeScale::GPST));
assert_eq!(TimeScale::from_str("GAL"), Ok(TimeScale::GST));
assert_eq!(TimeScale::from_str("BDS"), Ok(TimeScale::BDT));
}

#[test]
fn test_is_gnss() {
let ts = TimeScale::GPST;
Expand Down

0 comments on commit e44444e

Please sign in to comment.