Module: IERS::TaiUtcDrift Private
- Defined in:
- lib/iers/tai_utc_drift.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
TAI-UTC from 1961-01-01 to 1972-01-01, when UTC was steered by rate adjustments instead of whole leap seconds. In this era TAI-UTC is a linear function of MJD, restarting at each published step, so a value is +offset + (mjd - reference_mjd) * rate+.
The table is closed: the last segment ends where Leap_Second.dat begins and no new segment can ever be added.
Coefficients from the USNO tai-utc.dat file, the same values ERFA carries in dat.c. They are exact decimals, so they are stored as rationals rather than floats.
Defined Under Namespace
Classes: Segment
Constant Summary collapse
- FIRST_MJD =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
1961-01-01. Below this there is no published UTC, so TAI-UTC is undefined.
37_300- LAST_MJD =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
1972-01-01, where Leap_Second.dat takes over. The drift era stops here.
41_317- SEGMENTS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
[ Segment.new( start_mjd: 37_300, offset: Rational(14_228_180, 10_000_000), reference_mjd: 37_300, rate: Rational(1_296, 1_000_000) ), Segment.new( start_mjd: 37_512, offset: Rational(13_728_180, 10_000_000), reference_mjd: 37_300, rate: Rational(1_296, 1_000_000) ), Segment.new( start_mjd: 37_665, offset: Rational(18_458_580, 10_000_000), reference_mjd: 37_665, rate: Rational(11_232, 10_000_000) ), Segment.new( start_mjd: 38_334, offset: Rational(19_458_580, 10_000_000), reference_mjd: 37_665, rate: Rational(11_232, 10_000_000) ), Segment.new( start_mjd: 38_395, offset: Rational(32_401_300, 10_000_000), reference_mjd: 38_761, rate: Rational(1_296, 1_000_000) ), Segment.new( start_mjd: 38_486, offset: Rational(33_401_300, 10_000_000), reference_mjd: 38_761, rate: Rational(1_296, 1_000_000) ), Segment.new( start_mjd: 38_639, offset: Rational(34_401_300, 10_000_000), reference_mjd: 38_761, rate: Rational(1_296, 1_000_000) ), Segment.new( start_mjd: 38_761, offset: Rational(35_401_300, 10_000_000), reference_mjd: 38_761, rate: Rational(1_296, 1_000_000) ), Segment.new( start_mjd: 38_820, offset: Rational(36_401_300, 10_000_000), reference_mjd: 38_761, rate: Rational(1_296, 1_000_000) ), Segment.new( start_mjd: 38_942, offset: Rational(37_401_300, 10_000_000), reference_mjd: 38_761, rate: Rational(1_296, 1_000_000) ), Segment.new( start_mjd: 39_004, offset: Rational(38_401_300, 10_000_000), reference_mjd: 38_761, rate: Rational(1_296, 1_000_000) ), Segment.new( start_mjd: 39_126, offset: Rational(43_131_700, 10_000_000), reference_mjd: 39_126, rate: Rational(2_592, 1_000_000) ), Segment.new( start_mjd: 39_887, offset: Rational(42_131_700, 10_000_000), reference_mjd: 39_126, rate: Rational(2_592, 1_000_000) ), # Reached only by a direct TaiUtcDrift.at(41_317): LeapSecond.at's drift # branch requires query_mjd < 41_317. It pins the join to exactly 10, # matching Leap_Second.dat's first row; without it the 1968 segment would # give ~9.8922 here. Do not remove. Segment.new( start_mjd: 41_317, offset: Rational(10), reference_mjd: 41_317, rate: Rational(0) ) ].freeze
Class Method Summary collapse
-
.at(mjd) ⇒ Rational
private
TAI-UTC in seconds.
-
.covers?(mjd) ⇒ Boolean
private
Whether
athas a value for this MJD: 1961-01-01 up to but not including 1972-01-01, where Leap_Second.dat takes over.
Class Method Details
.at(mjd) ⇒ Rational
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns TAI-UTC in seconds.
35 36 37 38 39 40 |
# File 'lib/iers/tai_utc_drift.rb', line 35 def at(mjd) segment = SEGMENTS.reverse_each.find { |s| mjd >= s.start_mjd } segment.offset + (Rational(mjd) - segment.reference_mjd) * segment.rate end |
.covers?(mjd) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Whether at has a value for this MJD: 1961-01-01 up to but not including
1972-01-01, where Leap_Second.dat takes over. A caller with a custom leap
second file starting after 1972 relies on the upper bound to fall through
to its own error rather than reading a stale drift value.
49 50 51 |
# File 'lib/iers/tai_utc_drift.rb', line 49 def covers?(mjd) mjd >= FIRST_MJD && mjd < LAST_MJD end |