9inline constexpr uint32_t
WEEK_MS = 604800000;
12[[nodiscard]]
constexpr uint64_t
epochMs(uint32_t week, uint32_t towMs)
14 return uint64_t(week) *
WEEK_MS + towMs;
18[[nodiscard]]
constexpr bool towAdvances(uint32_t later, uint32_t earlier)
20 const uint64_t difference = (uint64_t(later) +
WEEK_MS - earlier) %
WEEK_MS;
21 return difference != 0 && difference <
WEEK_MS / 2;
GPS system time as receivers stamp their epochs: a week number and the milliseconds into that week.
constexpr uint64_t epochMs(uint32_t week, uint32_t towMs)
Milliseconds since the GPS epoch of towMs into week.
constexpr bool towAdvances(uint32_t later, uint32_t earlier)
Whether time of week later follows earlier by less than half a week, across the week rollover.
constexpr uint32_t WEEK_MS
Milliseconds in a GPS week; every time of week is below it.