Skip to content

A 13-Bit Week Read as 10-Bit

  • Satellite navigation time for any receiver: the six system times, week numbers and their rollovers, and RINEX navigation weeks.

A 13-Bit Week Read as 10-Bit

A QZSS CNAV message carries week 2295 and 86418 seconds into the week. The integration was written against the LNAV counter and uses it for every message. What does it return?

The naive approach

// The naive approach: one counter for every message
import { gnssWeekToUtc } from "@northguild/gmt/gnss/convert";

gnssWeekToUtc("QZS-LNAV", 2295, 86418, 0);
// "" — an LNAV week stops at 1023

// The quick fix: wrap the week to fit the counter
gnssWeekToUtc("QZS-LNAV", 247, 86418, 0);
// "1984-10-01T00:00:15Z" — 2295 mod 1024 is 247: a date, and the wrong one

Watch it break

The naive approach silently produces wrong results — there is no GMT equivalent to demonstrate because the failure is not using GMT.

Why

Not every message of a system uses the same counter. QZSS LNAV and NavIC LNAV count weeks in 10 bits. QZSS CNAV, GPS CNAV and NavIC L1NV count them in 13 bits, so the week runs to 8191 and the first wrap is far off. A week taken from a civil message and sent to a 10-bit counter is out of range, and the library returns an empty string rather than a date. Taking the remainder to make it fit turns the error into a plausible date 40 years early, so the counter has to be named by the message the week came from.

The gmt approach

import { gnssWeekToUtc, utcToGnssWeek } from "@northguild/gmt/gnss/convert";

gnssWeekToUtc("QZS-CNAV", 2295, 86418, 0);
// "2024-01-01T00:00:00Z"
utcToGnssWeek("QZS-CNAV", "2024-01-01T00:00:00Z");
// { week: 2295, timeOfWeekSeconds: 86418, era: 0 }

Same widget, working

output 

In the widget, change the counter between QZS-LNAV and QZS-CNAV with the same week and watch the answer change between empty and a date. The same holds for GPS-LNAV and GPS-CNAV, and for IRN-LNAV and IRN-L1NV. The GNSS Week Decoder names the counter every week fits, and the GNSS Rollover Checker shows when a receiver on the 13-bit QZSS counter would first read a wrong pass. The rules are in GNSS: System Time and Week Rollover.

Accessibility
© 2026 NorthGuild · Licences

Code examples: MIT-0. Packages: MIT. Third-party data and components: their own licences, credited where they appear. Everything else: © 2026 NorthGuild, all rights reserved.