Skip to content

Commit

Permalink
Fix TIME_OF_FIRST and TIME_OF_LAST OBS formatting
Browse files Browse the repository at this point in the history
Signed-off-by: Guillaume W. Bres <[email protected]>
  • Loading branch information
gwbres committed Mar 24, 2024
1 parent d927311 commit 6ea4c4f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions rinex/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ use std::collections::HashMap;
use std::io::prelude::*;
use std::str::FromStr;

use gnss::constellation::ParsingError as ConstellationParsingError;
use hifitime::Epoch;
use hifitime::{Epoch, Unit};
use thiserror::Error;

use gnss::constellation::ParsingError as ConstellationParsingError;

#[cfg(feature = "serde")]
use serde::Serialize;

Expand Down Expand Up @@ -1567,7 +1568,8 @@ impl Header {
fn fmt_observation_rinex(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
if let Some(obs) = &self.obs {
if let Some(e) = obs.time_of_first_obs {
let (y, m, d, hh, mm, ss, nanos) = e.to_gregorian_utc();
let (y, m, d, hh, mm, ss, nanos) =
(e + e.leap_seconds(true).unwrap_or(0.0) * Unit::Second).to_gregorian_utc();
writeln!(
f,
"{}",
Expand All @@ -1581,7 +1583,8 @@ impl Header {
)?;
}
if let Some(e) = obs.time_of_last_obs {
let (y, m, d, hh, mm, ss, nanos) = e.to_gregorian_utc();
let (y, m, d, hh, mm, ss, nanos) =
(e + e.leap_seconds(true).unwrap_or(0.0) * Unit::Second).to_gregorian_utc();
writeln!(
f,
"{}",
Expand Down

0 comments on commit 6ea4c4f

Please sign in to comment.