OpenGNSSLabSPP

Module 2 - Foundations

GPS Time Conversion

Convert a GPST calendar timestamp into Julian Date, GPS week, and seconds-of-week.

Difficulty

Fundamentals

Estimated time

14 minutes

Series position

2 of 11

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.

Prepared by OpenGNSSLabUpdated Sources, reproducibility and corrections

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.

year=2024,month=1,day=1,hour=1,minute=59,second=44year=2024,\quad month=1,\quad day=1,\quad hour=1,\quad minute=59,\quad second=44

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.

a=⌊14−month12⌋=1a=\left\lfloor\frac{14-month}{12}\right\rfloor=1
y=year+4800−a=6823,m=month+12a−3=10y=year+4800-a=6823,\qquad m=month+12a-3=10
JD=day+⌊153m+25⌋+365y+⌊y4⌋−⌊y100⌋+⌊y400⌋−32045JD=day+\left\lfloor\frac{153m+2}{5}\right\rfloor+365y+\left\lfloor\frac{y}{4}\right\rfloor-\left\lfloor\frac{y}{100}\right\rfloor+\left\lfloor\frac{y}{400}\right\rfloor-32045
JDUTC=2460310.583148148JD_{UTC} = 2460310.583148148

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.

JDGPS=2444244.5JD_{GPS}=2444244.5
GPSelapsed=(JDUTC−JDGPS)×86400+18 sGPS_{elapsed}=(JD_{UTC}-JD_{GPS})\times 86400 + 18\ \text{s}
GPSweek=2295,GPSSOW=93602 sGPS_{week}=2295,\qquad GPS_{SOW}=93602\ \text{s}

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

Help improve this tutorial

Point out numerical ambiguity, missing prerequisites, or a step that needs a fuller derivation.

Primary sources and further reading

The specifications and research below support the model and terminology. Numerical exports and teaching assumptions are documented in the lesson itself.

Browse the scientific reference library →

Continue with the numbers

GNSS terms and units · Report a correction