View Source SpaceDust.Time.UTC (Space Dust v0.3.0)
Coordinated Universal Time (UTC).
UTC is the primary civil time standard. It is kept within 0.9 seconds of UT1 (astronomical time based on Earth's rotation) by the insertion of leap seconds.
Internally stores time as fractional seconds since Unix epoch (1970-01-01 00:00:00 UTC).
Summary
Functions
Add seconds to UTC time.
Difference between two UTC times in seconds.
Create from year, month, day, hour, minute, second.
Create a UTC time from an Elixir DateTime.
Create a UTC time from a sigil-style DateTime.
Create from Julian Date.
Create from Modified Julian Date.
Create from Nx tensor.
Create a UTC time from Unix seconds.
Convert to an Elixir DateTime.
Convert to Julian Date.
Convert to Modified Julian Date.
Convert to Nx tensor (unix seconds).
Get the Unix seconds value.
Types
@type t() :: %SpaceDust.Time.UTC{unix_seconds: float()}
Functions
Add seconds to UTC time.
Difference between two UTC times in seconds.
Create from year, month, day, hour, minute, second.
@spec from_datetime(DateTime.t()) :: t()
Create a UTC time from an Elixir DateTime.
Create a UTC time from a sigil-style DateTime.
Example
iex> SpaceDust.Time.UTC.from_iso8601!("2024-01-01T12:00:00Z")
Create from Julian Date.
Create from Modified Julian Date.
@spec from_tensor(Nx.Tensor.t()) :: t()
Create from Nx tensor.
Create a UTC time from Unix seconds.
@spec to_datetime(t()) :: DateTime.t()
Convert to an Elixir DateTime.
Convert to Julian Date.
Convert to Modified Julian Date.
@spec to_tensor(t()) :: Nx.Tensor.t()
Convert to Nx tensor (unix seconds).
Get the Unix seconds value.