Epoch
このコンテンツはまだ日本語訳がありません。
Defined in: epoch.rs:273
pub struct Epoch\<S: [TimeScale](../../traits/timescale/) = [Utc](../utc/)\>An astronomical epoch represented as Julian Date in scale S.
S defaults to Utc so that Epoch (without type parameter) means
Epoch<Utc> — the most common user-facing scale.
Scale 解釈
Section titled “Scale 解釈”内部表現は単一の jd: f64 だが、その値は scale S で解釈される JD である。
つまり Epoch<Utc>::from_jd(x).jd() == x (UTC JD として round-trip)、
Epoch<Tdb>::from_jd_tdb(x).jd() == x (TDB JD として round-trip) となる。
Scale 間の変換 (to_tdb(), to_tt() 等) は内部で TAI を経由し leap second や
Fairhead 補正を適用して別 scale の JD を計算する。
Methods
Section titled “Methods”fn jd(&self) -> f64
Return the Julian Date value, interpreted in scale S.
fn mjd(&self) -> f64
Return the Modified Julian Date value, interpreted in scale S.
scale_name()
Section titled “scale_name()”fn scale_name() -> &‘static str
The human-readable scale name (e.g. “UTC”, “TDB”).
from_jd()
Section titled “from_jd()”fn from_jd(jd: f64) -> Self
Create a UTC epoch from a raw Julian Date (treated as UTC JD).
Legacy API matching the pre-refactor Epoch::from_jd. The resulting
Epoch<Utc>::jd() returns jd unchanged (round-trip identity).
from_mjd()
Section titled “from_mjd()”fn from_mjd(mjd: f64) -> Self
Create a UTC epoch from a Modified Julian Date value.
j2000()
Section titled “j2000()”fn j2000() -> Self
The J2000.0 reference epoch (JD 2451545.0).
歴史的には J2000.0 = 2000-01-01 12:00:00 TT だが、本実装では
UTC scale で JD 2451545.0 を返す (後方互換のため)。厳密な TT J2000
を得るには Epoch::<Tt>::from_jd_tt を使う。
from_datetime()
Section titled “from_datetime()”fn from_datetime(dt: &DateTime) -> Self
Create a UTC epoch from a DateTime value.
from_gregorian()
Section titled “from_gregorian()”fn from_gregorian(year: i32, month: u32, day: u32, hour: u32, min: u32, sec: f64) -> Self
Create a UTC epoch from Gregorian calendar date and time.
Uses the standard Julian Date algorithm valid for dates after the Gregorian calendar reform (1582-10-15).
from_iso8601()
Section titled “from_iso8601()”fn from_iso8601(s: &str) -> Option<Self>
Parse a UTC epoch from ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
Only UTC (Z suffix) is supported. Returns None if parsing fails.
fn now() -> Self
Create a UTC epoch from the current system time.
from_tle_epoch()
Section titled “from_tle_epoch()”fn from_tle_epoch(year_2digit: u32, day_of_year: f64) -> Self
Create a UTC epoch from a TLE epoch (2-digit year + fractional day of year).
2-digit year convention (NORAD): 57-99 → 1957-1999, 00-56 → 2000-2056.
centuries_since_j2000()
Section titled “centuries_since_j2000()”fn centuries_since_j2000(&self) -> f64
Julian centuries since J2000.0, computed directly from the UTC JD.
Note: This treats the UTC JD as if it were a dynamical-time JD,
which is strictly incorrect for high-precision ephemeris calculations.
For Meeus/JPL DE usage, prefer epoch.to_tdb().centuries_since_j2000().
This method is kept for legacy bit-level compatibility where UTC
centuries were used interchangeably with dynamical-time centuries.
add_seconds()
Section titled “add_seconds()”fn add_seconds(&self, dt: f64) -> Self
Advance the epoch by dt seconds using naive JD arithmetic
(jd + dt/86400). Does NOT handle leap second boundaries.
Legacy API for bit-level compatibility with pre-refactor Epoch::add_seconds.
For leap-second-aware arithmetic use add_si_seconds(Self::add_si_seconds)
instead.
add_si_seconds()
Section titled “add_si_seconds()”fn add_si_seconds(&self, dt: f64) -> Self
Advance the epoch by dt SI seconds, handling leap second boundaries.
Internally converts UTC → TAI, adds dt TAI seconds, and converts
back to UTC. Crossing a leap second boundary correctly absorbs the
extra second: 5 SI seconds from 2016-12-31T23:59:58 lands at
2017-01-01T00:00:02 (not 00:00:03), because one SI second is “consumed”
by the 2017-01-01 leap.
to_datetime()
Section titled “to_datetime()”fn to_datetime(&self) -> DateTime
Convert to Gregorian calendar date and time (UTC).
to_datetime_normalized()
Section titled “to_datetime_normalized()”fn to_datetime_normalized(&self) -> DateTime
Convert to Gregorian calendar date and time (UTC), with leap second
instants normalized to 00:00:00 of the next day.
Alias for to_datetime(Self::to_datetime) in Phase 1A (leap-instant
display 23:59:60 is not yet distinguished).
gmst()
Section titled “gmst()”fn gmst(&self) -> f64
Greenwich “sidereal time” in radians. Legacy method.
Actually computes the Earth Rotation Angle (IAU 2000 B1.8 / SOFA
iauEra00) assuming UT1 ≈ UTC (ignores dUT1). For the proper
canonical form use Epoch::<Ut1>::era after an explicit UT1
conversion via a proper EOP provider.
Kept on Epoch<Utc> for bit-level compatibility with the pre-refactor
Epoch::gmst method. Will be removed when downstream callers migrate
to Epoch<Ut1>::era.
to_tai()
Section titled “to_tai()”fn to_tai(&self) -> [Epoch<Tai>](/)
Convert to TAI by applying the current leap-second offset.
to_tt()
Section titled “to_tt()”fn to_tt(&self) -> [Epoch<Tt>](/)
Convert to TT via UTC → TAI → TT.
to_tdb()
Section titled “to_tdb()”fn to_tdb(&self) -> [Epoch<Tdb>](/)
Convert to TDB via UTC → TAI → TT → TDB (Fairhead-Bretagnon periodic).
to_ut1_naive()
Section titled “to_ut1_naive()”fn to_ut1_naive(&self) -> [Epoch<Ut1>](/)
Convert to UT1 assuming UT1 ≈ UTC (naive, legacy behavior).
真の UT1 が必要な場合は Epoch::<Utc>::to_ut1 (Ut1Offset provider を
引数に取る) を使う。本 method は NullEop 相当の dUT1 = 0 仮定で、
current arika の gmst() 実装との bit-level 互換を保つため提供される。
to_ut1()
Section titled “to_ut1()”fn to_ut1<P: Ut1Offset + ?Sized>(&self, eop: &P) -> [Epoch<Ut1>](/)
Convert to UT1 using the dUT1 = UT1 − UTC correction provided by
an EOP provider.
JD_UT1 = JD_UTC + dUT1 / 86400dUT1 is looked up at the current UTC MJD and is typically in the
range ±0.9 s. This is the precise UT1 conversion — the NullEop
placeholder type does not implement Ut1Offset, so passing it
is a compile error (see arika/tests/trybuild/).
The ?Sized bound lets callers pass trait objects directly
(e.g. &dyn Ut1Offset or Box<dyn Ut1Offset>::as_ref()) alongside
concrete types.
For a naive dUT1 = 0 conversion used by the legacy simple rotation
path, use Epoch::<Utc>::to_ut1_naive instead.
from_jd_tai()
Section titled “from_jd_tai()”fn from_jd_tai(jd: f64) -> Self
Create a TAI epoch from a Julian Date value interpreted as TAI JD.
to_tt()
Section titled “to_tt()”fn to_tt(&self) -> [Epoch<Tt>](/)
Convert to TT by adding the constant 32.184 s offset.
to_utc()
Section titled “to_utc()”fn to_utc(&self) -> [Epoch<Utc>](/)
Convert to UTC by subtracting the current leap-second offset.
from_jd_tt()
Section titled “from_jd_tt()”fn from_jd_tt(jd: f64) -> Self
Create a TT epoch from a Julian Date value interpreted as TT JD.
centuries_since_j2000()
Section titled “centuries_since_j2000()”fn centuries_since_j2000(&self) -> f64
Return TT Julian centuries since J2000.0.
この値が IAU 2006 precession / IAU 2000A/B nutation の独立変数。
to_tai()
Section titled “to_tai()”fn to_tai(&self) -> [Epoch<Tai>](/)
Convert to TAI by subtracting the constant 32.184 s offset.
to_tdb()
Section titled “to_tdb()”fn to_tdb(&self) -> [Epoch<Tdb>](/)
Convert to TDB via the Fairhead-Bretagnon periodic correction.
from_jd_tdb()
Section titled “from_jd_tdb()”fn from_jd_tdb(jd: f64) -> Self
Create a TDB epoch from a Julian Date value interpreted as TDB JD.
JPL DE ephemerides use Teph which is for practical purposes
indistinguishable from TDB (IAU 2006 Resolution B3).
centuries_since_j2000()
Section titled “centuries_since_j2000()”fn centuries_since_j2000(&self) -> f64
Return TDB Julian centuries since J2000.0.
Meeus / JPL DE ephemeris と IAU 2009 WGCCRE body rotation の独立変数。
to_tt()
Section titled “to_tt()”fn to_tt(&self) -> [Epoch<Tt>](/)
Convert to TT by applying the inverse Fairhead-Bretagnon correction.
from_jd_ut1()
Section titled “from_jd_ut1()”fn from_jd_ut1(jd: f64) -> Self
Create a UT1 epoch from a Julian Date value interpreted as UT1 JD.
fn era(&self) -> f64
Earth Rotation Angle (ERA) in radians.
IAU 2000 Resolution B1.8 / SOFA iauEra00:
ERA(T_u) = 2π × (0.7790572732640 + 1.00273781191135448 × T_u)
where T_u = JD_UT1 − 2451545.0.
ERA は UT1 の definitional な関数であり、他の scale で計算することは
意味論的に間違い。したがって era() method は Epoch<Ut1> にのみ
提供される (Epoch<Tdb>::era() はコンパイルエラー)。