Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix time scale interpretation #162

Merged
merged 16 commits into from
Sep 19, 2023
4 changes: 2 additions & 2 deletions rinex/src/clocks/record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub enum Error {
#[error("unknown data code \"{0}\"")]
UnknownDataCode(String),
#[error("failed to parse epoch")]
EpochError(#[from] epoch::Error),
EpochParsingError(#[from] epoch::ParsingError),
#[error("failed to parse # of data fields")]
ParseIntError(#[from] std::num::ParseIntError),
#[error("failed to parse data payload")]
Expand Down Expand Up @@ -187,7 +187,7 @@ pub(crate) fn parse_epoch(
+2+1 // m
+11; // s
let (epoch, rem) = rem.split_at(offset);
let (epoch, _) = epoch::parse(epoch.trim())?;
let (epoch, _) = epoch::parse_utc(epoch.trim())?;

// nb of data fields
let (n, _) = rem.split_at(4);
Expand Down
14 changes: 13 additions & 1 deletion rinex/src/constellation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,20 @@ impl Constellation {
Err(ParsingError::Unrecognized(code.to_string()))
}
}
/// Converts self into time scale
pub fn to_timescale(&self) -> Option<TimeScale> {
match self {
Self::GPS | Self::QZSS => Some(TimeScale::GPST),
Self::Galileo => Some(TimeScale::GST),
Self::BeiDou => Some(TimeScale::BDT),
Self::Geo | Self::SBAS(_) => Some(TimeScale::GPST),
// this is wrong but we can't do better
Self::Glonass | Self::IRNSS => Some(TimeScale::UTC),
_ => None,
}
}
/// Converts self to 1 letter code (RINEX standard code)
pub fn to_1_letter_code(&self) -> &str {
pub(crate) fn to_1_letter_code(&self) -> &str {
match self {
Self::GPS => "G",
Self::Glonass => "R",
Expand Down
Loading