Time

The Time submodule contains common time transformations such as converting between different date representations or converting a specific instant in time between different time systems.

The module also defines the Epoch class which provides the standard representation of instants in time used throughout the module.

Most of the transformations are make backend calls to the SOFA C-library functions provide the package SOFA.jl

SatelliteDynamics.caldate_to_mjdFunction

Convert a Gregorian calendar date to the equivalent Modified Julian Date representation of that time instant.

Aguments:

  • year::Integer Year
  • year::Integer Month
  • year::Integer Day
  • hour::Integer Hour
  • minute::Integer Minute
  • second::Real Seconds
  • nanoseconds::Real Nanoseconds

Returns:

  • mjd::Float64 Modified Julian Date of Epoch
source
SatelliteDynamics.mjd_to_caldateFunction

Convert a Modified Julian Date to the equivalent Gregorian calendar date representation of the same instant in time.

Aguments:

  • mjd::Real: Modified Julian Date of Epoch

Returns:

  • year::Int: Year
  • year::Int: Month
  • year::Int: Day
  • hour::Int: Hour
  • minute::Int: Minute
  • second::Float64: Seconds
  • nanoseconds::Float64: Nanoseconds
source
SatelliteDynamics.caldate_to_jdFunction

Convert a Gregorian calendar date to the equivalent Julian Date representation of that time instant.

Aguments:

  • year::Integer: Year
  • year::Integer: Month
  • year::Integer: Day
  • hour::Integer: Hour
  • minute::Integer: Minute
  • second::Real: Seconds
  • nanoseconds::Real: Nanoseconds

Returns:

  • mjd::Float64: Julian Date of Epoch
source
SatelliteDynamics.jd_to_caldateFunction

Convert a Julian Date to the equivalent Gregorian calendar date representation of the same instant in time.

Aguments:

  • jd::Real: Julian Date of Epoch

Returns:

  • year::Int: Year
  • year::Int: Month
  • year::Int: Day
  • hour::Int: Hour
  • minute::Int: Minute
  • second::Float64: Seconds
  • microsecond::Float64: Nanoseconds
source
SatelliteDynamics.elapsed_from_epochFunction

Compute the number of elapsed seconds since a given Epoch from the day number. Can be used to compute the elapsed time since a given Julian or Modified Julian Date.

Arguments:

  • day_number::Real: Day number, can contain fractional days. Asummes all days are a uniform 86400.0 seconds in length.
  • day_epoch::Real: Modified Julian Date of Epoch

Returns:

  • t::Float: Number of elapsed seconds between the Provided Modified Julian date and the epoch.
source
SatelliteDynamics.days_from_elapsedFunction

Computes the day number in a given time scale given the elapsed time since epoch and the epoch itself.

Assumes all days are counted using a uniform 86400.0 seconds over the time span.

Arguments:

  • t::Real: Elapsed seconds since the day_epoch.
  • day_epoch::Real: Day number of the epoch. Common values are SatelliteDynamics.MJD_ZERO (to get the Julian Day number) or SatelliteDynamics.MJD2000 (to get Modified Julian Days if reckoning time from January 1, 2000 0H)

Returns:

  • days::Float: Number of elapsed days in the time scale.
source
SatelliteDynamics.time_system_offsetFunction

Compute the offset between two time systems at a given Epoch.

The offset (in seconds) is computed as:

time_system_offset = tsys_dest - tsys_src

The value returned is the number of seconds that musted be added to the source time system given the input epoch, to get the equivalent epoch.

Conversions are accomplished using SOFA C library calls. Epoch.

Arguments:

  • jd::Real: Part 1 of two-part date (Julian days)
  • fd::Real: Part 2 of two-part date (Fractional days)
  • tsys_src::String: Base time system
  • tsys_dest::String: Destination time system

Returns:

  • offset::Float: Offset between soruce and destination time systems in seconds.
source
SatelliteDynamics.EpochType

The Epoch type represents a single instant in time. It is used throughout the SatelliteDynamics module. It is meant to provide a clear definition of moments in time and provide a convenient interface display time in various representations as well as in differrent time systems. The internal data members are also chosen such that the representation maintains nanosecond-precision in reprersenation of time and doesn't accumulate floating-point arithmetic errors larger than nanoseconds even after centuries.

Supports +, +=, -, and -= operators. Two Epoch's can be differenced to return the time difference between two Epochs. If adding a Real number it is interpreted as an offset in seconds to add to the Epoch.

The class also supports all arithmetic operators: ==, !=, <, <=, >, >=

Arguments:

  • year::Int Year
  • year::Int Month
  • year::Int Day
  • hour::Int Hour (optional)
  • minute::Int Minute (optional)
  • second::Real Seconds (optional)
  • nanoseconds::Real Nanoseconds (optional)
  • tsys::String: Time system of the epoch at initialization

The Epoch class can be also be initialized from a string. Examples of Valid String constructors are:

epc = Epoch("2018-12-20")
epc = Epoch("2018-12-20T16:22:19.0Z")
epc = Epoch("2018-12-20T16:22:19.123Z")
epc = Epoch("2018-12-20T16:22:19.123456789Z")
epc = Epoch("2018-12-20T16:22:19Z")
epc = Epoch("20181220T162219Z")
epc = Epoch("2018-12-01 16:22:19 GPS")
epc = Epoch("2018-12-01 16:22:19.0 GPS")
epc = Epoch("2018-12-01 16:22:19.123 GPS")
epc = Epoch("2018-12-01 16:22:19.123456789 GPS")
source
SatelliteDynamics.caldateFunction

Return the Gregorian calendar date for a specific

Arguments:

  • epc::Epoch: Input epoch
  • tsys::String: Time system to compute output in.

Returns:

  • year::Int: Year of epoch
  • month::Int: Month of epoch
  • day::Int: Day of epoch
  • hour::Int: Hour of epoch
  • minute::Int: Minute of epoch
  • second::Int: Second of epoch
  • nanoseconds::Int: Year of epoch
source
SatelliteDynamics.jdFunction

Compute the Julian Date for a specific epoch

Arguments:

  • epc::Epoch: Epoch
  • tsys::String: Time system to return output in

Returns:

  • jd::Real: Julian date of the epoch in the requested time system
source
SatelliteDynamics.mjdFunction

Compute the Modified Julian Date for a specific epoch

Arguments:

  • epc::Epoch: Epoch
  • tsys::String: Time system to return output in

Returns:

  • mjd::Real: Julian date of the epoch in the requested time system
source
SatelliteDynamics.day_of_yearFunction

Return the day-of-year number for a given Epoch.

January 1 0h of each year will return 1.

Arguments:

  • epc::Epoch: Epoch
  • tsys::String: Time system to return output in

Returns:

  • doy::Real: Day of year number.
source
SatelliteDynamics.gmstFunction

Compute the Greenwich Mean Sidereal Time for the given Epoch.

Arguments:

  • epc::Epoch: Epoch
  • use_degrees::Bool: Return output in degrees (Default: false)

Returns:

  • gmst::Real: Greenwich Mean Sidereal Time [rad/deg]
source
SatelliteDynamics.gastFunction

Compute the Greenwich Mean Sidereal Time for the given Epoch.

Arguments:

  • epc::Epoch: Epoch
  • use_degrees::Bool: Return output in degrees (Default: false)

Returns:

  • gast::Real: Greenwich Apparent Sidereal Time [rad/deg]
source
SatelliteDynamics.epoch_to_jdfdFunction

Compute the two-part date format used by SOFA.jl functions forr a given Epoch.

Arguments:

  • epc::Epoch: Epoch
  • tsys::String: Time system to return output in

Returns:

  • d1::Real: First part of two part date. [days]
  • d2::Real: Second part of two part date. [days]
source