Skip to content

MTC seconds roll to 60 #9

Description

@mMerlin

Are you still keeping an eye on this repo?

I spotted a bug in the MTC hh:mm:ss display. I am writing my own python based clock based on the glss algorithm information, and used Mars Clock as a cross check of my implementation.

The bug:
millis = 947,116,815,000 ¦ MTC 23:59:59
millis = 947,116,816,000 ¦ MTC 23:59:60
millis = 947,116,817,000 ¦ MTC 00:00:01

The seconds is rolling over from 59 to 60, instead of to zero and incrementing the minutes. That looks like the fractional seconds are being rounded for the seconds display value, but because it is not really the next second (minute) yet, the minutes do not increment. For a clock display, I think that should truncate (or use floor), so that the seconds value does not increment until the tenths of a second truly rolls over.

Those times are a few seconds off from what I expected from https://www.giss.nasa.gov/tools/mars24/help/algorithm.html and the near coincident worked example for 2000/01/06. 2000/01/06 00:00:00 should be MTC 23:59:39 (21 seconds before Mars midnight) A glance at the code shows that you are using a fixed value of 37 for the tai-utc offset. That likely accounts for the difference. I implemented a table lookup to handle the changing offset. Only works from 1972/01/01 forward.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions