A Fixed Gap Applied to an Old Log
A Fixed Gap Applied to an Old Log
A receiver on a ship wrote Galileo time into its log in June 2016. A tool converts the whole archive with the gap that holds today. Which UTC second does the first line name?
The naive approach
// The naive approach: one gap for every date
const GALILEO_AHEAD_OF_UTC = 18; // seconds, true since the start of 2017
const toGalileo = (utc) => new Date(Date.parse(utc) + GALILEO_AHEAD_OF_UTC * 1000).toISOString();
toGalileo("2016-06-01T00:00:00Z");
// "2016-06-01T00:00:18.000Z" — the receiver wrote 00:00:17 that dayWatch it break
The naive approach silently produces wrong results — there is no GMT equivalent to demonstrate because the failure is not using GMT.
Why
Every satellite system keeps a continuous clock, so its lead over UTC grows by one second each time UTC inserts a leap second. Galileo time led UTC by 17 seconds in June 2016 and has led it by 18 seconds since the last insertion, at the end of that year. A gap typed in once is right for one stretch of dates and wrong for every other. `utcToGnss` reads the gap from the leap-second table for the date it is given, and `gnssToUtc` reads it back the same way.
The gmt approach
import { gnssToUtc, utcToGnss } from "@northguild/gmt/gnss/convert";
utcToGnss("GAL", "2016-06-01T00:00:00Z");
// "2016-06-01T00:00:17 GAL"
utcToGnss("GAL", "2024-01-01T00:00:00Z");
// "2024-01-01T00:00:18 GAL"
gnssToUtc("GAL", "2016-06-01T00:00:17 GAL");
// "2016-06-01T00:00:00Z"Same widget, working
Change the system in the widget to BDT and the gap becomes 3 seconds in June 2016 and 4 seconds
since 2017, because its clock was set to UTC at its own start in 2006. Change the date to one before 2006 and BDT returns an empty string: BeiDou time did not exist yet. The
Satellite Clock Converter shows every system’s gap for 1 June 2016 side by side. The rules are in GNSS: System Time and Week
Rollover.
© 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.