View Source SpaceDust.Time.GPS (Space Dust v0.3.0)

GPS Time.

GPS Time is a continuous time scale used by the Global Positioning System. It started at midnight UTC on January 6, 1980 (the GPS epoch) and does not include leap seconds.

GPS = TAI - 19 seconds

At the GPS epoch, GPS time was synchronized with UTC. Since then, leap seconds have been added to UTC but not to GPS time, so they have diverged.

GPS time is often expressed as a week number and seconds of week.

Internally stores time as fractional seconds since GPS epoch.

Summary

Functions

Add seconds to GPS time.

Get day of week (0 = Sunday).

Difference between two GPS times in seconds.

Create from Nx tensor.

Create from GPS week number and seconds of week.

Get the GPS epoch in Unix seconds.

Create a GPS time from GPS seconds (since GPS epoch).

Get seconds of week (0 to 604800).

Seconds per GPS week.

Get the GPS seconds value (since GPS epoch).

Convert to Nx tensor (GPS seconds since epoch).

Convert to GPS week number and seconds of week. Returns {week_number, seconds_of_week}.

Get GPS week number.

Types

t()

@type t() :: %SpaceDust.Time.GPS{gps_seconds: float()}

Functions

add(gps, seconds)

@spec add(t(), number()) :: t()

Add seconds to GPS time.

day_of_week(gps)

@spec day_of_week(t()) :: integer()

Get day of week (0 = Sunday).

diff(gps1, gps2)

@spec diff(t(), t()) :: float()

Difference between two GPS times in seconds.

from_tensor(tensor)

@spec from_tensor(Nx.Tensor.t()) :: t()

Create from Nx tensor.

from_week_and_seconds(week, seconds_of_week)

@spec from_week_and_seconds(integer(), float()) :: t()

Create from GPS week number and seconds of week.

gps_epoch_unix()

Get the GPS epoch in Unix seconds.

new(gps_seconds)

@spec new(float()) :: t()

Create a GPS time from GPS seconds (since GPS epoch).

seconds_of_week(gps)

@spec seconds_of_week(t()) :: float()

Get seconds of week (0 to 604800).

seconds_per_week()

Seconds per GPS week.

to_seconds(gps)

@spec to_seconds(t()) :: float()

Get the GPS seconds value (since GPS epoch).

to_tensor(gps)

@spec to_tensor(t()) :: Nx.Tensor.t()

Convert to Nx tensor (GPS seconds since epoch).

to_week_and_seconds(gps)

@spec to_week_and_seconds(t()) :: {integer(), float()}

Convert to GPS week number and seconds of week. Returns {week_number, seconds_of_week}.

week_number(gps)

@spec week_number(t()) :: integer()

Get GPS week number.