Skip to content

GpsWeek

Defined in: gps.rs:36

pub struct GpsWeek

A continuous GPS week number, counted from the GPS epoch (1980-01-06) with no 1024-week rollover.

The 10-bit value broadcast in the GPS navigation message rolls over every 1024 weeks (~19.6 years; last rollovers 1999-08-22 and 2019-04-06). Use from_broadcast(Self::from_broadcast) to lift such a raw value into a continuous week.

const fn new(continuous_week: u32) -> Self

Wrap a continuous (already de-rolled) week number.


const fn get(self) -> u32

The continuous week number.


fn from_broadcast<P: Precision>(raw10: u16, reference: &[Epoch<Gps, P>](../epoch/)) -> Self

Resolve a broadcast week into a continuous week, choosing the 1024-week era whose week is nearest reference.

Only the low 10 bits of raw10 are used (the navigation message field is 10 bits); any higher bits are reduced modulo 1024. reference only needs to be within ~9.8 years (half a rollover period) of the true epoch for the resolution to be correct — e.g. the receiver’s build date or a coarse current time. A non-finite / pre-epoch reference is treated as era 0.