Skip to content

JdRepr

Defined in: jd2.rs:38

pub trait JdRepr: sealed::Sealed + [Copy](https://doc.rust-lang.org/std/marker/trait.Copy.html) + [PartialEq](https://doc.rust-lang.org/std/cmp/trait.PartialEq.html) + [core::fmt::Debug](https://doc.rust-lang.org/std/fmt/trait.Debug.html)

The Julian Date storage behind a canonical-TAI Epoch(super::Epoch): a JD value plus the day-level arithmetic the epoch applies (lens conversion, duration_since, add_si_seconds). Sealed — the only impls are f64 (the coarse tier) and TwoPartJd (the precise tier); which one an Epoch stores is selected by its (also sealed) Precision(super::Precision), so this is a closed set, not a downstream extension point.

fn from_jd(jd: f64) -> Self

From a single f64 JD. For TwoPartJd the residual is zero — precision beyond f64 is only created by the arithmetic methods, never ingested here.


fn from_parts(hi: f64, lo: f64) -> Self

From an explicit high part and residual. For f64 this collapses to hi + lo; for TwoPartJd it retains the residual (renormalized). This is the lossless bridge between tiers (see Epoch::to_precision(super::Epoch::to_precision)).


fn jd(self) -> f64

The value as a single f64 (a lossy collapse for the precise tier).


fn parts(self) -> (f64, f64)

The (hi, lo) parts; lo is always 0.0 for the coarse f64 tier.


fn add_days(self, days: f64) -> Self

Add days, keeping whatever precision the representation carries.


fn diff_days(self, other: Self) -> f64

Difference self - other in days.