You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The next chunk of changes from
#122.
This re-implements the time related functionality in native Rust. This
one is a bit larger, mostly from the fact that the conversions in the C
implementation are very inter-dependent and so several new bits of
functionality were pulled in to make the Rust implementation mirror the
C implementation. There's a few bits of functionality thrown out because
they caused some significant unsoundness, but I'm sure there is still
several bits of unsoundness in this translation (e.g. several
panics/asserts are still present). I'd prefer to keep this PR as close
to a straight translation as possible, and re-consider the soundness
concerns in a future PR.
## What's been changed
- I don't think any implementations are still present but meaningfully
modified
## What's been removed
- `GloTime` - GLONASS time is particularly complicated and rarely used
- `GpsTime::to_glo()` and `GpsTime::to_glo_hardcoded()` - See above
- `impl Sub<GpsTime> for GpsTime` - It turns out a `std::time::Duration`
can't hold a negative value. This implementation would occasionally
panic because of this. [The `chrono`
crate](https://docs.rs/chrono/latest/chrono/#time-delta--duration)
handles this better, maybe we can move towards their approach in a later
PR?
- `UtcParams::decode()` - Decoding low-level messages seem unlikely to
be needed
- `impl Default for UtcParams` - Defaulting this data can cause
unexpected errors
- `impl Default for UtcTime` - Defaulting this type can cause unexpected
errors
## What's been added
- The `time::consts` module
- `GpsTime::from_date()` and `GpsTime::from_date_hardcoded()`
- `GpsTime::to_mjd()` and `GpsTime::to_mjd_hardcoded()`
- `GpsTime::to_date()` and `GpsTime::to_date_hardcoded()`
- `UtcTime::to_date()`
- `MJD::to_gps()` and `MJD::to_gps_hardcoded()`
- `MJD::to_date()`
---------
Co-authored-by: Alejandro Duarte <[email protected]>
0 commit comments