Repository navigation
Make Mars time a service: library, JSON API, embeddable widget, AI tools, rebuilt clock - #4
Merged
Merged
Conversation
- lib/marstime.js: one dependency-free ES module with Mars24 (MSD, MTC, Ls, local solar times, Mars Year, rover sols) and the InterImm calendar, clock and timezones. TAI-UTC now comes from the IERS leap-second table (37 s), not a fixed 35 s. - lib/marstime.test.mjs: checks NASA's worked example, published Mars Year start dates, round trips, and 400 readings recorded from the old clock. - lib/mars-clock-element.js: <mars-clock> element for other pages. - api/v1: static JSON generated by tools/build-api.mjs; CI checks it is fresh. - index.html, en/index.html: one bilingual page on the shared InterImm kit; old doc pages redirect to its sections. Old jQuery/Bootstrap assets removed. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J6QUBjpnDrbJzB9khfJfmc
…nAPI) - lib/mars-clock-card.js: <mars-clock-card>, a styled widget in a shadow root (lang, zone, longitude/place, theme, rovers, compact). - embed/: iframe version for sites that don't allow scripts. - Embed builder with live preview on the clock page (zh and en). - mcp/server.mjs: dependency-free MCP server over stdio, runnable with `npx -y github:InterImm/mars-clock#gh-pages`; also a one-shot `now` CLI. Tools: get_mars_time, interimm_to_earth, mission_sol, sol_to_earth, mars_year_dates. Tested over stdio in mcp/server.test.mjs. - llms.txt, llms-full.txt (generated, includes formulas and library source) and api/v1/openapi.json. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J6QUBjpnDrbJzB9khfJfmc
emptymalei
marked this pull request as ready for review
October 3, 2026 11:20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by L · project thread
Before: the clock was a 2016 jQuery/Bootstrap page whose maths lived inside a DOM-bound script with no tests. It assumed TAI−UTC = 35 s, so it has run 2 s behind since 2017, and nothing else could reuse it.
After: Martian time is a small service that costs nothing to run.
lib/marstime.jsis one ES module with no dependencies. It covers Mars24 (MSD, MTC, Ls, LMST/LTST at any longitude, Mars Year, subsolar point, rover sols) plus the InterImm calendar, clock and 25 timezones, and it uses the correct IERS leap-second table. Import it fromhttps://cdn.jsdelivr.net/gh/InterImm/mars-clock@gh-pages/lib/marstime.js.<mars-clock-card>(lib/mars-clock-card.js) is a styled card in a shadow root, with language, zone, longitude, theme, rovers and compact options.embed/is the iframe version for sites that block scripts. The clock page has an embed builder with a live preview and a copy button.<mars-clock>remains for bare text.mcp/server.mjsis a dependency-free MCP server. Add it withclaude mcp add mars-time -- npx -y github:InterImm/mars-clock#gh-pagesor the equivalent JSON config. Its tools areget_mars_time,interimm_to_earth,mission_sol,sol_to_earthandmars_year_dates, and… now --longitude 137.44works as a one-shot shell command. There are alsollms.txt,llms-full.txt(formulas plus the library source, generated) andapi/v1/openapi.json.api/v1/holds static JSON: daily tables for 2000–2050, Mars Year and InterImm year start dates, missions, and leap seconds. It is generated bytools/build-api.mjs, and CI fails if it orllms-full.txtis stale./中文,/en/) is rebuilt on the shared InterImm kit (https://interimm.org/kit/, live since interimm.github.io#53 merged). It has the live clock, a zone picker, local time anywhere, Earth↔Mars converters, a month calendar, a timezone table, the embed builder and developer docs. The old doc pages now redirect to its sections, and the old jQuery/Bootstrap assets (~7 MB) are removed.How: the library is a cleaned-up port of the old
marsclock.jsusing NASA GISS's current Mars24 constants.npm testruns 18 tests. They check NASA's 2000-01-06 worked example, the published starts of Mars Years 1, 24 and 36–39, round trips, and 400 readings recorded from the old clock. They also drive the MCP server over stdio. I checked thenpx github:…install against this branch.Changes in behaviour, all relative to the old code:
The
@gh-pagesCDN links and the#gh-pagesnpx command start working once this is merged.🤖 Generated with Claude Code
https://claude.ai/code/session_01J6QUBjpnDrbJzB9khfJfmc