Instants, time scales and ΔT #2

Closed
opened 2026-10-22 22:33:45 -05:00 by jeff · 0 comments
Owner

Part of #1

Parent

#1

What to build

astro.time: an instant that carries its time scale (TT or UT), and ΔT so that callers can work in civil time. An instant can be made from a Julian Day and a time scale, from a Unix timestamp (counted as UT), or from a calendar date and time of day in an explicitly chosen Julian or Gregorian calendar, and read back as each of those. It converts between TT and UT, using the Espenak–Meeus 2006 ΔT polynomials (with their documented extrapolation outside −1999…+3000) or a ΔT the caller supplies. The model's ΔT at an instant can be asked for directly.

This ticket also sets up the property and fuzz testing the rest of the work uses: fuzz targets that are also ordinary tests on fixed seeds, a zig build fuzz step for --fuzz, and a test binary compiled with LLVM.

Source: Meeus, Astronomical Algorithms, 2nd ed., ch. 7 and ch. 10; Espenak and Meeus's ΔT polynomials.

Acceptance criteria

  • Ch. 7's worked examples (Julian Day from a calendar date and back, in both calendars) pass to the printed precision
  • There is no automatic switch between calendars at 1582 October 15; the caller chooses
  • Converting TT → UT → TT round-trips, and ΔT matches published Espenak–Meeus values at several sample years
  • A caller-supplied ΔT overrides the model
  • A fuzz target shows that no function panics for any f64 Julian Day, and that NaN or ±∞ gives NaN
  • zig build fuzz --fuzz=10K runs and reports coverage
  • Every new public declaration has a doc comment giving units, time scale and reference frame, and citing the chapter and equation of Meeus it implements
  • Every source used is in the README's references cited
  • zig build test, zig build check, zig fmt --exclude zig-pkg --check . and reuse lint pass
Part of #1 ## Parent #1 ## What to build `astro.time`: an **instant** that carries its **time scale** (TT or UT), and **ΔT** so that callers can work in civil time. An instant can be made from a Julian Day and a time scale, from a Unix timestamp (counted as UT), or from a calendar date and time of day in an explicitly chosen Julian or Gregorian calendar, and read back as each of those. It converts between TT and UT, using the Espenak–Meeus 2006 ΔT polynomials (with their documented extrapolation outside −1999…+3000) or a ΔT the caller supplies. The model's ΔT at an instant can be asked for directly. This ticket also sets up the property and fuzz testing the rest of the work uses: fuzz targets that are also ordinary tests on fixed seeds, a `zig build fuzz` step for `--fuzz`, and a test binary compiled with LLVM. Source: Meeus, *Astronomical Algorithms*, 2nd ed., ch. 7 and ch. 10; Espenak and Meeus's ΔT polynomials. ## Acceptance criteria - [ ] Ch. 7's worked examples (Julian Day from a calendar date and back, in both calendars) pass to the printed precision - [ ] There is no automatic switch between calendars at 1582 October 15; the caller chooses - [ ] Converting TT → UT → TT round-trips, and ΔT matches published Espenak–Meeus values at several sample years - [ ] A caller-supplied ΔT overrides the model - [ ] A fuzz target shows that no function panics for any `f64` Julian Day, and that NaN or ±∞ gives NaN - [ ] `zig build fuzz --fuzz=10K` runs and reports coverage - [ ] Every new public declaration has a doc comment giving units, time scale and reference frame, and citing the chapter and equation of Meeus it implements - [ ] Every source used is in the README's references cited - [ ] `zig build test`, `zig build check`, `zig fmt --exclude zig-pkg --check .` and `reuse lint` pass
jeff self-assigned this 2026-10-22 22:35:10 -05:00
jeff closed this issue 2026-10-22 23:37:20 -05:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
jeff/zig-astro#2
No description provided.