User:Schrauber5/Marstime
Usage
[edit]Template to calculate Earth time from Mars Sol and Mars time by difference to reference event. For the reference event Earth time (parameter: UTC_ref), Mars day (parameter: Sol_ref) and Mars time (parameter: Mars_time_ref) need to be given.
Calculation is done in Unix time (seconds):
Earth time = Earth reference + Sol difference * 1 Sol / 1 day + Mars time difference = UTC_ref + (Sol - Sol_ref) * 1.02749125 + (Mars_time - Mars_time_ref) * 1.02749125
The usage of the template e.g.
- {{Marstime|Sol_ref=76|Mars_time_ref=12:34|UTC_ref=2021-05-07 19:26:00 |Sol=58|Mars_time=12:35}}
will give the result
- 2021-04-19T07:34:26+00:00
That might be converted via the #time parser. E.g.
- {{#time: F d, Y \a\t G:i (e)| {{Marstime|...}}}}
will give the result
- April 19, 2021 at 7:34 (UTC)
5 Parameters
[edit]Given reference time in Earth time and Mars Sol and Mars time:
- UTC_ref (yyyy-mm-dd hh:mm:ss)
- Sol_ref (integer number)
- Mars_time_ref (hh:mm)
Note: Fixed values for one mission but different for different missions. e.g. Mars2020: UTC_ref=2021-05-07 19:26:00, Sol_ref=76, Mars_time_ref=12:34
Mars Sol and Mars Time that will be converted:
- Sol (integer number)
- Mars_time (hh:mm)
Output
[edit](Earth) Time with format according to Code c of Time parser: ISO 8601 formatted date, equivalent to Y-m-d"T"H:i:s+00:00.
May be converted via #time to different format.
Used Parsers
[edit]- https://www.mediawiki.org/wiki/Help:Extension:ParserFunctions#.23time
- https://www.mediawiki.org/wiki/Help:Extension:ParserFunctions##expr
Verbose explanation
[edit]The idea is to have a reference event were Earth time and Mars time are given (parameter marked with _ref) and then calculate the difference to the requested time and multiply it with the ratio of the scale see Proportionality (mathematics)
Earth reference is the time of the reference event in Earth time
Sol difference is the difference of the reference Sol number from the given Sol number. When the Sol reference was Sol 3 and template shall be used for an event at Sol 5 the sol difference = 5 - 3 = 2
1 Sol / 1 day: one Sol_(day_on_Mars) has a duration of 24:39:35.244, one day has the duration of 24:00:00. A division results in the value 1.02749125
Time difference: is the difference of the reference Mars time from the given Mars time . When the reference Mars time was 12:35 and template shall be used for an event time of 12:37 time difference = 12:37-12:35 = 00:02. The time difference is also multiped with a scale ratio since the length of a Mars second is stretched compared to an earth second, so that a Mars sol also consists of 24h of 60 minutes consisting also of 60 seconds.
Simple example
[edit]If the reference event is at sol 100, local Mars time 12:30 and the event in question is at sol 101, same local Mars time then the result is the given reference Earth time + (1 sol = 1 day + 39 min 35 s)