Timekeeping on other celestial bodies than Earth
The HORIZONS web interface allows for you to change the observer location to other bodies in the solar system.  Select &quot;Observer location [change] and read the instructions carefully.  I was able to generate an ephemeris showing the Sun's position for the Viking lander location by entering in &quot;Viking 1@499&quot;.  Mars is designated by &quot;@499&quot; and it allows you to enter in any Mars surface coords (Mars lat/long) before the @499 to generate the ephemeris.  There is a search function to find the code for nearly anything in the solar system; it will always be @ something.
To determine when the Sun rises and sets on Mars, you'll also need to change the columns returned to include &quot;Apparent AZ/EL&quot; (azimuth and elevation over the horizon).  Also, you'll want to have it run for the accuracy you're looking for, such as every 5 mins or every 1 min, etc. Here is a screenshot using 10 mins for the step time.