## Mars24 Sunclock — Time on Mars

### Algorithm and Worked Examples

(Updated 2019-09-17)

The calculations made by Mars24 to determine the time for a given location on Mars are primarily based on Allison and McEwen (2000) (henceforth AM2000). We also refer to Allison (1997) (henceforth A1997), of which AM2000 was a thorough update. However, some typographical errors appeared in the published version of AM2000, and some calculations have been revised since that paper was published because of the availability of new data. These updates may appear in a paper in preparation by Allison.

Consequently, we provide here step-by-step documentation of the equations currently employed by Mars24 for users who wish to implement their own Mars timekeeping applications. At the end of this presentation, we also provide worked examples for verification of intermediate results.

### I. Equations

#### A. Determine Days Since J2000 Epoch

Our Mars time calculations will use the parameter
Δ`t`_{J2000}, the elapsed time in days since the J2000
epoch, i.e., 12:00 on Jan. 1, 2000 (TT). The following describes how we get
there from a Java call which returns the system time. If one has an alternative
scheme for obtaining Δ`t`_{J2000}, then these steps can be skipped.

A-1. Get a starting Earth time.

Mars24 is written in Java, so we use the
`System.currentTimeMillis()`

method to find out the number of
milliseconds, `millis`, that have elapsed since 00:00:00 on Jan. 1, 1970
(i.e., the Unix epoch).

Unfortunately, most if not all Java implementations
(or the operating systems on which they run) do not keep track of
leap seconds, i.e.,
they keep time in UT rather than UTC. Consequently, when Mars24 calls
`System.currentTimeMillis()`

, it assumes that
the value returned uses UT rather than UTC.

Only A-2 in the following steps explicitly uses `millis`.
However, there are some displays in Mars24 which also use other readings
based on the value of `millis`,
so there is a possibility that if Mars24 is used on a computer and
Java implementation which
*do* keep track of leap seconds, display errors could result.

A-2. Convert millis to Julian Date (UT).

Although there's plenty of sample code available on-line which demonstrates how to convert a Gregorian calendar date to a Julian Date, we simply use the offset from a known, recent Julian Date. Again, we use the Unix epoch, 00:00:00 on Jan. 1, 1970.

JD_{UT}
= 2440587.5 + (`millis` / 8.64×10^{7} ms/day)

A-3. Determine time offset from J2000 epoch (UT).

This step is optional; we only need to make this calculation if
the date is *before* Jan. 1, 1972.
Determine the elapsed time in Julian centuries since
12:00 on Jan. 1, 2000 (UT).

`T`
= (JD_{UT} - 2451545.0) / 36525.

A-4. Determine UTC to TT conversion. (Replaces AM2000, eq. 27)

Terrestrial Time (TT) advances at constant rate, as does UTC, but no leap seconds are inserted into it and so it gradually gets further ahead of UTC. The best way to determine the difference between TT and UTC is to consult a table of leap seconds. Alternatively, one could try to use an empirical formula.

In Mars24 we, oddly enough, use both methods. We use the USNO table for dates after Jan. 1, 1972, and a formula for dates prior to then. In consulting the USNO table>, however, it is important to note that the table provides values for the TAI-UTC difference, where TAI is International Atomic Time. To obtain the TT-UTC difference, add 32.184 seconds to the value of TAI-UTC. For example, the USNO table indicates that on Jan. 1, 2006, the TAI-UTC value is 33.0 seconds, and thus, the value for TT-UTC on that date (and until the next date on which another leap second is added to the clock) would be 33.0s + 32.184s = 65.184s.

The formula applied for dates prior to Jan. 1, 1972, is similar to AM2000, eq. 27, but has been revised and includes additional terms:

TT - UTC = 64.184s
+ 59 s × `T`
- 51.2 s × `T`^{2}
- 67.1 s × `T`^{3}
- 16.4 s × `T`^{4}

(Note: Mars24 uses the USNO table which includes the leap second added July 1, 2012. Obviously, then, it does not allow for any leap seconds which might be subsequently added. Bulletin C 33 from the IERS Earth Orientation Centre indicates this will not occur any earlier than Jan. 1, 2009.)

A-5. Determine Julian Date (TT).

JD_{TT}
= JD_{UT} + [(TT - UTC) / 86400 s·day^{-1}]

A-6. Determine time offset from J2000 epoch (TT). (AM2000, eq. 15)

Δ`t`_{J2000}
= JD_{TT} - 2451545.0

#### B. Determine Mars Parameters of Date

Now we turn our attention to Mars, first determining some orbital parameters.

B-1. Determine Mars mean anomaly. (AM2000, eq. 16)

`M`
= 19.3871° + 0.52402073° Δ`t`_{J2000}

B-2. Determine angle of Fiction Mean Sun. (AM2000, eq. 17)

α_{FMS}
= 270.3871° + 0.524038496° Δ`t`_{J2000}

B-3. Determine perturbers. (AM2000, eq. 18)

PBS
= Σ_{(i=1,7)} `A`_{i} cos [ (0.985626° Δ`t`_{J2000} / τ_{i}) + φ_{i}]

where 0.985626° = 360° / 365.25, and

i | A_{i} |
τ_{i} |
φ_{i} |
---|---|---|---|

1 | 0.0071 | 2.2353 | 49.409 |

2 | 0.0057 | 2.7543 | 168.173 |

3 | 0.0039 | 1.1177 | 191.837 |

4 | 0.0037 | 15.7866 | 21.736 |

5 | 0.0021 | 2.1354 | 15.704 |

6 | 0.0020 | 2.4694 | 95.528 |

7 | 0.0018 | 32.8493 | 49.095 |

B-4. Determine Equation of Center. (Bracketed term in AM2000, eqs. 19 and 20)

The equation of center is the true anomaly minus mean anomaly.

ν - `M`
= (10.691° + 3.0° × 10^{-7} Δ`t`_{J2000}) sin `M`
+ 0.623° sin 2`M`
+ 0.050° sin 3`M`
+ 0.005° sin 4`M`
+ 0.0005° sin 5`M`
+ PBS

B-5. Determine areocentric solar longitude. (AM2000, eq. 19)

`L`_{s}
= α_{FMS} + (ν - `M`)

#### C. Determine Mars Time

C-1. Determine Equation of Time. (AM2000, eq. 20)

EOT
= 2.861° sin 2`L`_{s}
- 0.071° sin 4`L`_{s}
+ 0.002° sin 6`L`_{s}
- (ν - `M`)

The above result for EOT is in degrees. Multiply by (24 h / 360°) = (1 h / 15°) to obtain the result in hours.

C-2. Determine Coordinated Mars Time, i.e., Airy Mean Time. (AM2000, eq. 22, modified)

This is the mean solar time at Mars's prime meridian.

MTC
= mod_{24} { 24 h × ( [(JD_{TT} - 2451549.5) / 1.0274912517] + 44796.0 - 0.0009626 ) }

The function mod_{X} indicates a re-setting of the function
parameter, a cyclical value, to a value between 0 and `X`. In this
case, we apply mod_{24} to indicate that values outside the
range 0-24 should be re-set to be within that range, e.g.,
mod_{24} (30) = 6.

C-3. Determine Local Mean Solar Time.

The Local Mean Solar Time for a given planetographic longitude, Λ, in degrees west, is easily determined by offsetting from the mean solar time on the prime meridian.

LMST
= mod_{24} { MTC - Λ (24 h / 360°) }
= mod_{24} { MTC - Λ (1 h / 15°) }

C-4. Determine Local True Solar Time. (AM2000, eq. 23)

LTST = LMST + EOT (24 h / 360°) = LMST + EOT (1 h / 15°)

C-5. Determine subsolar longitude

Λ_{s}
= MTC (360° / 24 h) + EOT + 180°
= MTC (15° / h) + EOT + 180°

#### D. Additional Calculations

D-1. Determine solar declination (planetographic). (A1997, eq. 5)

δ_{s}
= arcsin {0.42565 sin `L`_{s})}
+ 0.25° sin `L`_{s}

D-2. Determine heliocentric distance. (AM2000, eq. 25, corrected)

`R`_{M}
= 1.52367934 ×
(1.00436
- 0.09309 cos M
- 0.004336 cos 2`M`
- 0.00031 cos 3`M`
- 0.00003 cos 4`M`)

D-3. Determine heliocentric longitude. (AM2000, eq. 26)

`l`_{M}
= `L`_{s}
+ 85.061°
- 0.015° sin (71° + 2`L`_{s})
- 5.5°×10^{-6} Δ`t`_{J2000}

D-4. Determine heliocentric latitude.

`b`_{M}
= - (1.8497° - 2.23°×10^{-5} Δ`t`_{J2000})
sin (`L`_{s} - 144.50° + 2.57°×10^{-6} Δ`t`_{J2000})

D-5. Determine local solar elevation

For any given point on Mars's surface, we want to determine the angle of the sun. The zenith angle is:

`Z`
= arccos (sin δ_{s} sin φ + cos δ_{s} cos φ cos `H`)

where φ is the planetographic latitude,
Λ is the planetographic longitude,
and `H` the hour angle,
Λ - Λ_{s}.

The solar elevation is simply 90° - `Z`.

D-6. Determine local solar azimuth

The second element of the sun's location as seen from a point on Mars's surface is its azimuth, i.e., compass angle relative to due north.

`A`
= arctan (sin `H` / (cos φ tan δ_{s} - sin φ cos `H`))

(Note: When applying this equation in your computer code or spreadsheet, use the
`atan2` function so that the correct quadrant is obtained.)

### II. Worked Examples

#### Near Coincident Earth and Mars Times

An easy-to-remember benchmark for calibrating clocks is a date and time at which the "standard time" for both Mars and Earth was almost the same. When the time on Earth was 00:00:00 on Jan. 6, 2000 (UTC), it was just 21 Mars-seconds away from also being mean midnight at the Mars prime meridian. Let's run through the calculations to see if we obtain MTC = 23:59:39. For longitude and latitude, we specify 0°W 0°N.

Eq. | Parameter | Value |
---|---|---|

A-1 | millis |
947116800000 ms |

A-2 | JD_{UT} |
2451549.5 |

A-3 | T |
— |

A-4 | TT - UTC | 64.184 s |

A-5 | JD_{TT} |
2451549.50074 |

A-6 | Δt_{J2000} |
4.50074 |

B-1 | M |
21.74558° |

B-2 | α_{FMS} |
272.74566° |

B-3 | PBS | 0.00142° |

B-4 | ν - M |
4.44193° |

B-5 | L_{s} |
277.18758° |

C-1 | EOT | -5.18774° = -0.34585 h = -00:20:45 |

C-2 | MTC | mod_{24} (1075103.99425 h) = 23.99425 h = 23:59:39 |

C-3 | LMST | 23.99425 h = 23:59:39 |

C-4 | LTST | 23.64840 h = 23:38:54 |

C-5 | Λ_{s} |
174.72600° |

D-1 | δ_{s} |
-25.22825° |

D-2 | R_{M} |
1.39358 AU |

D-3 | l_{M} |
2.26352° |

D-4 | b_{M} |
-1.35957° |

D-5 | Z |
154.26182° |

D-6 | A |
191.03905° |

#### MER-A *Spirit* Landing

The Mars Exploration Rover A, *Spirit*, landed on Jan. 4, 2004
(UTC; in U.S. timezones it was late Jan. 3). For the planned landing
target, local true midnight prior to touchdown was expected at 13:46:31 UTC
on Jan. 3.
We specify longitude and latitude of 184.702°W -14.640°N.
We expect to obtain that the Mars local time at that location was
LTST = 00:00:00 and the solar azimuth was 180°.

Eq. | Parameter | Value |
---|---|---|

A-1 | millis |
1073137591000 ms |

A-2 | JD_{UT} |
2453008.07397 |

A-3 | T |
— |

A-4 | TT - UTC | 64.184 s |

A-5 | JD_{TT} |
2453008.07471 |

A-6 | Δt_{J2000} |
1463.07471 |

B-1 | M |
786.06858° → 66.06858° |

B-2 | α_{FMS} |
1037.09457° → 317.09457° |

B-3 | PBS | 0.01614° |

B-4 | ν - M |
10.22959° |

B-5 | L_{s} |
1047.32416° → 327.32416° |

C-1 | EOT | -12.77553° = -0.85170 h = -00:51:06 |

C-2 | MTC | mod_{24} (1109173.16537 h) = 13.16537 h = 13:09:55 |

C-3 | LMST | 0.85190 h = 00:51:07 |

C-4 | LTST | 0.00025 h = 00:00:00 |

C-5 | Λ_{s} |
4.70500° |

D-1 | δ_{s} |
-13.42065° |

D-2 | R_{M} |
1.47767 AU |

D-3 | l_{M} |
52.37564° |

D-4 | b_{M} |
0.08965° |

D-5 | Z |
151.93895° |

D-6 | A |
179.99383° |

### Reference

Discussion of the data and formulae used by Mars24 may be found in:

- Allison, M. 1997.
Accurate analytic representations of solar time and seasons on Mars with applications
to the Pathfinder/Surveyor missions.
Geophys. Res. Lett.
**24**, 1967-1970. - Allison, M., and M. McEwen 2000.
A post-Pathfinder evaluation of aerocentric solar coordinates with improved timing
recipes for Mars seasonal/diurnal climate studies.
Planet. Space Sci.
**48**, 215-235.

Subsequent to May 2008, the following revisions have been made here:

- 2013-05-24: Typo fixed.
- 2014-10-14: Demonstration of C-2 in first worked example corrected to include the raw result prior to calculating the mod-24 value.
- 2015-06-30: Equations B-1, B-2, C-2, and D-2 were modified according to recent research by Allison (2015) and the worked examples correspondingly updated.
- 2018-04-03, 09-26: Updated journal article links and cleaned up some HTML.