GPS Time Converter. Weeks & Seconds Since 1980
GPS receivers count time in weeks and seconds since January 6, 1980. This converter translates between GPS time and UTC using the full IERS leap-second table: 18 seconds today, and the historically correct offset for older logs.
GPS time.
Week numbers and seconds-of-week since the GPS epoch — January 6, 1980. The IERS leap-second table is applied automatically, so pre-2017 logs convert with the offset that was current at the time.
GPS time = UTC − 18 s offset. Total GPS seconds = weeks × 604800 + seconds of week.
How GPS time works
The GPS system counts whole weeks and seconds-of-week since its epoch: midnight UTC on Sunday, January 6, 1980. A GPS time like week 2430, second 432018 means 2430 weeks plus 432,018 seconds after that instant.
GPS time is continuous, it ignores leap seconds entirely. UTC, meanwhile, inserts a leap second whenever Earth's rotation drifts too far from atomic time. The result is that the GPS clock runs 18 seconds ahead of UTC today. To convert:
- GPS → Unix:
unix = gps_total + 315964800 - leap_seconds. - Unix → GPS:
gps_total = unix - 315964800 + leap_seconds, thenweeks = floor(gps_total / 604800).
The leap-second offset (18 s today, table-correct for older dates)
GPS−UTC is not a constant: it was 0 at the 1980 epoch and grew by one second at each of the 18 leap seconds IERS Bulletins announced since. It has been 18 seconds since January 1, 2017 (Bulletin C 53). This converter ships the full table, so it applies the offset that was in force at the instant being converted — 15 s for a 2009 log, 13 s for 2000, 0 s at the epoch — instead of naively subtracting 18 everywhere.
Weeks and seconds-of-week, decoded
- Week
0, second0→ January 6, 1980 00:00:00 UTC, but the epoch instant is actually 18 s after GPS time zero. - Week
2430, second432018→ August 7, 2026 00:00:00 UTC.
Converting in Python, Go, and C# (with the offset caveat)
The 18 in these snippets is today's offset — correct for any date from
2017-01-01 until the next leap second. For older timestamps, substitute the offset in
force at that instant (15 s for 2009–2011, 14 s for 2012–2014, 13 s for 1999–2005, …).
- Go:
time.Unix(315964800 - 18 + week*604800 + sow, 0).UTC(). - Python:
datetime(1980, 1, 6, tzinfo=timezone.utc) + timedelta(seconds=week*604800 + sow + 18), add the leap offset to land on the same UTC instant. - C:
unix = gps + 315964800 - 18withgmtime_r().
Gotchas: week rollover, leap-second drift, and day 0
- Week rollover. GPS broadcasts the week number as 10 bits (0–1023), so it wraps every ~19.6 years: August 22, 1999 and April 6, 2019. Logs with small week numbers may need +1024 or +2048 added back.
- Leap seconds drift — the 18 s offset is only correct between 2017 and the next leap second. This converter handles that automatically via the IERS table, but code that hardcodes 18 s will mis-date older logs.
- Seconds-of-week range, valid values are 0–604799; 604800 is the start of the next week.
- Day 0 is Sunday. GPS weeks begin Sunday, so second 0–86399 is Sunday.
First published · Last reviewed · Maintained and developed by the Real Epoch Converter team · Email · Contact · Methodology
Leap seconds and the clocks that ignore them
GPS time is one of three major clock policies; the others and their conversion traps: