Skip to content

v0.1.0

Choose a tag to compare

@MiCkEyZzZ MiCkEyZzZ released this 21 Apr 12:51

Release v0.1.0 — Type‑safe GNSS time core

gnss-time is a zero‑cost, no_std‑friendly Rust library for working with time in satellite navigation systems (GPS, GLONASS, Galileo, BeiDou, TAI, UTC).

What's included

Core types

  • Duration – signed nanosecond interval (i64) with arithmetic, saturating ops, and Display.
  • Time<S> – parametric timestamp (u64) representing nanoseconds since the scale’s epoch.
  • TimeScale sealed trait – markers for Gps, Glonass, Galileo, Beidou, Tai, Utc.

Time scales & epochs

  • Epoch constants: GPS_EPOCH, GLONASS_EPOCH, GALILEO_EPOCH, BEIDOU_EPOCH, TAI_EPOCH, UNIX_EPOCH.
  • CivilDate with const calendar arithmetic.
  • Compile‑time verified offsets between epochs (days, seconds, nanoseconds).
  • GPS: Time<Gps>::from_week_tow(week, tow_s) + accessors week(), tow_seconds(), sub_second_nanos().
  • GLONASS: Time<Glonass>::from_day_tod(day, tod_s) + accessors day(), tod_seconds().

Leap seconds (contextual conversions)

  • LeapSeconds – static built‑in table (19 entries, 1980–2017).
  • LeapSecondsProvider trait for custom / runtime sources.
  • Conversions: gps_to_utc, utc_to_gps, glonass_to_utc, utc_to_glonass, gps_to_glonass, glonass_to_gps.
  • Tests for leap second boundaries (1998-12-31, 2016-12-31).

Display formatting

  • WeekTow (GPS/Galileo/BeiDou): "GPS 2345:432000.000"
  • DayTod (GLONASS): "GLO 10512:43200.000"
  • Simple (TAI/UTC): "TAI +1000000000s 0ns"

Error handling

  • GnssTimeError with Overflow, InvalidInput, LeapSecondsRequired.

Examples

  • basic_usage, gps_week_tow, glonass_day_tod, scale_conversion, display_formats, and more.

Documentation & metadata

  • README.md, CHANGELOG.md, #![deny(missing_docs)].
  • no_std by default, optional std feature.
  • All types are 8 bytes, repr(transparent) – zero overhead.

Full Changelog: CHANGELOG.md