Sidereon.GNSS.Antex.Epoch (Sidereon v3.0.0)

Copy Markdown View Source

A GPS-time VALID FROM / VALID UNTIL bound with its exact fraction of a second.

The F13.7 seconds field can state more decimals than a NaiveDateTime holds (59.9999999, .123456789012, 1.2345678E-9), so the fraction is kept as fraction_digits / 10^fraction_scale, normalized with no trailing zero digit (a zero fraction is 0 over 0). second is 0..59: GPS time has no leap-second label.

Summary

Functions

A NaiveDateTime as a bound, its microseconds kept exactly.

The bound as a NaiveDateTime when its fraction is a whole number of microseconds, {:error, :sub_microsecond_fraction} otherwise.

Types

t()

@type t() :: %Sidereon.GNSS.Antex.Epoch{
  day: 1..31,
  fraction_digits: non_neg_integer(),
  fraction_scale: non_neg_integer(),
  hour: 0..23,
  minute: 0..59,
  month: 1..12,
  second: 0..59,
  year: integer()
}

Functions

from_naive_datetime(ndt)

@spec from_naive_datetime(NaiveDateTime.t()) :: t()

A NaiveDateTime as a bound, its microseconds kept exactly.

to_naive_datetime(epoch)

@spec to_naive_datetime(t()) :: {:ok, NaiveDateTime.t()} | {:error, term()}

The bound as a NaiveDateTime when its fraction is a whole number of microseconds, {:error, :sub_microsecond_fraction} otherwise.