GPS time conversion, in brief
GPS time is a continuous time scale counted from the GPS epoch. This example converts a calendar timestamp already expressed in GPS time into Julian Date, GPS week and seconds-of-week. Converting a UTC timestamp first requires the applicable GPS−UTC offset; that is a separate operation.
Learning objectives
- Extract date-time components for GNSS processing.
- Compute Julian Date with the Gregorian calendar formula.
- Convert elapsed GPS seconds into seconds-of-week.
Why GPS time is the first numerical dependency
GPS time conversion turns a calendar time tag into the GPS week and seconds-of-week used by GNSS observation, orbit, clock, and correction models.
Every observation equation needs a time tag. RINEX observations, broadcast navigation records, SP3 epochs, satellite clocks, and Earth rotation corrections all depend on consistent time handling.
GPS time starts at 1980-01-06 00:00:00 GPST and is handled as a continuous count. This example is labelled UTC: compute JD in UTC, then add the epoch-appropriate GPS−UTC leap-second offset before deriving the GPST week and seconds-of-week.
Step 1
Extract the date-time components
For the example timestamp `2024-01-01 01:59:44`, split the string into integer components.
Step 2
Compute the Julian Date
Use the Gregorian calendar conversion. The time-of-day term shifts the day boundary to noon, which is standard for Julian Date.
Step 3
Convert Julian Date to GPS seconds-of-week
Subtract the GPS epoch Julian Date, multiply by seconds per day, then reduce modulo one GPS week.
Minimal implementation
from datetime import datetime, timezone, timedelta
GPS_EPOCH = datetime(1980, 1, 6, tzinfo=timezone.utc)
def gps_week_sow_from_utc(value: str) -> tuple[int, float]:
utc = datetime.fromisoformat(value).replace(tzinfo=timezone.utc)
gpst = utc + timedelta(seconds=18) # GPS-UTC on 2024-01-01
elapsed = (gpst - GPS_EPOCH).total_seconds()
return divmod(elapsed, 604800)
Common mistake
Do not mix GPS Time and UTC without accounting for leap seconds. For RINEX/SP3 workflows, always verify which time scale the file uses before combining records.
Result
Computed result
Week 2295 · SOW 93,602 s
The UTC timestamp maps to 93,602 seconds into GPS week 2295 after adding the 18-second GPS−UTC offset.
References
What you should understand now
- GPS seconds-of-week is a modulo-reduced time variable.
- Julian Date conversion is deterministic but easy to shift by 12 hours if the time fraction is handled incorrectly.
- This time value becomes an input to satellite clock, orbit, and interpolation steps.
Related tutorials
Observations and files
RINEX Observation Basics
Learn how to read a RINEX 3 observation file: header fields, C1C/L1C observation codes, time systems, epoch records, and satellite rows.
Satellite orbits and ephemerides
Keplerian Elements in GPS Navigation Messages
A numerical map of GPS broadcast ephemeris fields: clock parameters, orbit shape, harmonic corrections, time references, and hardware delays.
Help improve this tutorial
Point out numerical ambiguity, missing prerequisites, or a step that needs a fuller derivation.