JulianDay

public struct JulianDay : NumericType, CustomStringConvertible

The Julian Day is a continuous count of days and fractions thereof from the beginning of the year -4712. By tradition, the Julian Day begins at Greenwhich mean noon, that is, at 12h Universal Time. Julian Day structs conform to SwiftAA Numeric type protocol.

  • The Julian Day value

    Declaration

    Swift

    public let value: Double
  • Creates a Julian Day initialized to contain the given value.

    Declaration

    Swift

    public init(_ value: Double)

    Parameters

    value

    The value for the new Julian Day.

  • Creates a Julian Day initialized from a given Gregorian calendar date, in the UT reference frame, provided by its date components. Hour, minute and second are optional (and set to 0 by default).

    Declaration

    Swift

    public init(year: Int, month: Int, day: Int, hour: Int = 0, minute: Int = 0, second: Double = 0.0)

    Parameters

    year

    The year of the date.

    month

    The month of the date (january = 1)

    day

    The day of the date

    hour

    The hour of the date

    minute

    The minute of the date

    second

    The second of the date. Precision goes to the nanosecond.

  • Returns a Julian Day struct initialized from a given Gregorian calendar date, in the UT reference frame, provided as a Date instance.

    Declaration

    Swift

    public init(_ date: Date)

    Parameters

    date

    The date object.

  • Returns a Julian Day struct initialized from a Modified Julian Day (MJD) value.

    Declaration

    Swift

    public init(modified: Double)

    Parameters

    modified

    The Modified Julian Day value.

  • Returns a new Date object, in the Gregorian calendar, corresponding to the Julian Day value.

    Declaration

    Swift

    var date: Date { get }
  • Returns the so-called Modified Julian Day corresponding to the Julian Day value. Contrary to the JD, the Modified Julian Day begins at Greenwhich mean midnight. It is equal to JD - 2400 000.5

    Declaration

    Swift

    var modified: Double { get }
  • Returns the Julian Day corresponding to the Greenwhich midnight before the actual value.

    Declaration

    Swift

    var midnight: JulianDay { get }
  • Returns the Julian Day corresponding to the geometric midnight local to a given Earth longitude, before the actual value. It is a direct function of the longitude, and makes no reference to time zone whatsoever. Once transformed to a Date object, it will most probably not corresponds to the normal “midnight” date & hour, since the latter is identical by convention on a given timezone. The local date however is always respected (since you may cross the new-date line depending on longitude).

    Declaration

    Swift

    func localMidnight(longitude: Degree) -> JulianDay

    Parameters

    longitude

    The observer longitude

    Return Value

    Julian Day instance.

  • Returns the Julian Day corresponding to the local midnight, based on timezone.

    Declaration

    Swift

    func localMidnight(timeZone: TimeZone) -> JulianDay

    Parameters

    timeZone

    The time zone.

    Return Value

    A Julian Day object

  • Computes the mean sidereal time for the Greenwich meridian.

    That is, the Greenwich hour angle of the mean vernal point (the intersection of the ecliptic of the date with the mean equator of the date).

    Declaration

    Swift

    func meanGreenwichSiderealTime() -> Hour

    Return Value

    The sidereal time in hours.

  • Computes the mean sidereal time for a given longitude on Earth.

    Declaration

    Swift

    func meanLocalSiderealTime(longitude: Degree) -> Hour

    Parameters

    longitude

    Positively Westward (see AA p. 93 for explanations). Basically: this is the contrary of IAU decision. But this orientation is consistent with longitude orientation in all other planets!

    Return Value

    The sidereal time in hours.

  • Computes the apparent sidereal time.

    That is, the Greenwich hour angle of the true vernal equinox, obtained by adding a correction that depends on the nutation in longitude, and the true obliquity of the ecliptic.

    Declaration

    Swift

    func apparentGreenwichSiderealTime() -> Hour

    Return Value

    The sidereal time in hours.

  • Obliquity of the ecliptic, that is, the angle between the ecliptic and the celestial equator.

    Declaration

    Swift

    func obliquityOfEcliptic(mean: Bool = true) -> Degree

    Parameters

    mean

    If true, compute the mean obliquity. Otherwise, compute the true obliquity.

    Return Value

    The obliquity of the ecliptic, in degrees.

Dynamical Times

  • Returns the difference bewteeen TD (the ‘Time Dynamical’), and UT (the Universal Time). TD was later renamed TT for Terrestrial Time (which is a fairly unfortunate naming…).

    Declaration

    Swift

    func deltaT() -> Second

    Return Value

    The number of seconds (and fraction of thereof) between TD and UT.

  • Return the total of leap seconds added to the UTC since their introduction in 1972. See here http://tycho.usno.navy.mil/leapsec.html for a thorough explanation.

    Declaration

    Swift

    func cumulativeLeapSeconds() -> Second

    Return Value

    The total number of leap seconds accumulated since their introduction until the given JD.

  • Transform a Terrestrial Time (TT) value in a UTC (Coordinated Universal Time) one. UTC differs from TAI by an integral number of seconds. UTC is kept within 0.9 seconds of UT1 by the introduction of one-second steps to UTC, the “leap second.” To date these steps have always been positive. See AA p.77- and http://tycho.usno.navy.mil/systime.html

    Declaration

    Swift

    func TTtoUTC() -> JulianDay

    Return Value

    A new julian day

  • Transform a UTC (Universal Time Coordinates) value in a Terrestrial Time (TT) one. UTC differs from TAI by an integral number of seconds. UTC is kept within 0.9 seconds of UT1 by the introduction of one-second steps to UTC, the “leap second.” To date these steps have always been positive See AA p.77- and http://tycho.usno.navy.mil/systime.html

    Declaration

    Swift

    func UTCtoTT() -> JulianDay

    Return Value

    A new julian day

  • Transform a Terrestrial Time (TT) value in a TAI one. TAI is the International Atomic Time scale, a statistical timescale based on a large number of atomic clocks See AA p.77- and http://tycho.usno.navy.mil/systime.html

    Declaration

    Swift

    func TTtoTAI() -> JulianDay

    Return Value

    A new julian day

  • Transform a TAI value to a Terrestrial Time (TT) one. TAI is the International Atomic Time scale, a statistical timescale based on a large number of atomic clocks See AA p.77- and http://tycho.usno.navy.mil/systime.html

    Declaration

    Swift

    func TAItoTT() -> JulianDay

    Return Value

    A new julian day

  • Transform a Terrestrial Time (TT) value in a UT1 one. Universal Time (UT) is counted from 0 hours at midnight, with unit of duration the mean solar day, defined to be as uniform as possible despite variations in the rotation of the Earth. UT0 is the rotational time of a particular place of observation. It is observed as the diurnal motion of stars or extraterrestrial radio sources. UT1 is computed by correcting UT0 for the effect of polar motion on the longitude of the observing site. It varies from uniformity because of the irregularities in the Earth’s rotation. See AA p.77- and http://tycho.usno.navy.mil/systime.html

    Declaration

    Swift

    func TTtoUT1() -> JulianDay

    Return Value

    A new julian day

  • Transform a UT1 value in a Terrestrial Time (TT) one. Universal Time (UT) is counted from 0 hours at midnight, with unit of duration the mean solar day, defined to be as uniform as possible despite variations in the rotation of the Earth. UT0 is the rotational time of a particular place of observation. It is observed as the diurnal motion of stars or extraterrestrial radio sources. UT1 is computed by correcting UT0 for the effect of polar motion on the longitude of the observing site. It varies from uniformity because of the irregularities in the Earth’s rotation. See AA p.77- and http://tycho.usno.navy.mil/systime.html

    Declaration

    Swift

    func UT1toTT() -> JulianDay

    Return Value

    A new julian day

  • Computes the difference between UT1 and UTC. Not to be confused with Delta T. See AA p.77- and http://tycho.usno.navy.mil/systime.html

    Declaration

    Swift

    func UT1minusUTC() -> Second

    Return Value

    A difference in Seconds.

  • The description of the Julian Day.

    Declaration

    Swift

    var description: String { get }