pub struct GPS(/* private fields */);Expand description
GPS Time representation.
Wraps a JulianDate to provide type safety and GPS-specific operations.
The inner Julian Date uses split storage (jd1 + jd2) to preserve precision.
Implementations§
Source§impl GPS
impl GPS
Sourcepub fn new(seconds: i64, nanos: u32) -> Self
pub fn new(seconds: i64, nanos: u32) -> Self
Creates GPS time from Unix timestamp components.
Converts seconds and nanoseconds since Unix epoch (1970-01-01 00:00:00) to a Julian Date representation.
Sourcepub fn from_julian_date(jd: JulianDate) -> Self
pub fn from_julian_date(jd: JulianDate) -> Self
Creates GPS time from a Julian Date.
Sourcepub fn from_julian_date_raw(jd1: f64, jd2: f64) -> Self
pub fn from_julian_date_raw(jd1: f64, jd2: f64) -> Self
Creates GPS time from raw Julian Date components.
Prefer this over from_julian_date(JulianDate::new(...)) when you already
have the split components, as it avoids intermediate allocations.
Sourcepub fn to_julian_date(&self) -> JulianDate
pub fn to_julian_date(&self) -> JulianDate
Returns the underlying Julian Date.
Sourcepub fn add_seconds(&self, seconds: f64) -> Self
pub fn add_seconds(&self, seconds: f64) -> Self
Adds seconds to this GPS time, returning a new instance.
Precision is preserved by adding to the smaller-magnitude JD component.
Trait Implementations§
Source§impl From<JulianDate> for GPS
Converts a Julian Date to GPS time.
impl From<JulianDate> for GPS
Converts a Julian Date to GPS time.
Source§fn from(jd: JulianDate) -> Self
fn from(jd: JulianDate) -> Self
Source§impl FromStr for GPS
Parses an ISO 8601 datetime string as GPS time.
impl FromStr for GPS
Parses an ISO 8601 datetime string as GPS time.
The parsed time is interpreted directly as GPS (no leap second handling).
Source§impl ToGPS for GPS
Identity conversion for GPS.
impl ToGPS for GPS
Identity conversion for GPS.
Source§fn to_gps(&self) -> TimeResult<GPS>
fn to_gps(&self) -> TimeResult<GPS>
Returns self unchanged.
Source§impl ToTAI for GPS
GPS to TAI conversion. Adds 19 seconds.
impl ToTAI for GPS
GPS to TAI conversion. Adds 19 seconds.
Source§fn to_tai(&self) -> TimeResult<TAI>
fn to_tai(&self) -> TimeResult<TAI>
Converts GPS time to TAI by adding the fixed 19-second offset.
The offset is added to the smaller-magnitude JD component to preserve precision.