Class: Horologium::Scales::TT
- Defined in:
- lib/horologium/scales/tt.rb,
sig/horologium/scales/tt.rbs
Overview
Terrestrial Time, the scale the theories of the solar system motion are written in, and the one an ephemeris expects. It is exactly 32.184 SI seconds ahead of TAI. The offset is fixed by definition, so this conversion needs no external data.
The 32.184 seconds come from Ephemeris Time, the scale used before atomic clocks. TT continues it, and the offset is the gap between the two when TAI took over.
Constant Summary collapse
- SECONDS_AHEAD_OF_TAI =
The SI seconds TT is ahead of TAI.
Rational(32_184, 1_000)
- DAYS_AHEAD_OF_TAI =
The same offset in days, because a Julian Date counts days.
SECONDS_AHEAD_OF_TAI / Duration::SECONDS_PER_DAY
- OFFSETS =
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.
The offset at each precision, built once, so a conversion does not build it again every time.
Numeric::Precision::NAMES.map do |precision| [precision, Numeric::Precision.build(DAYS_AHEAD_OF_TAI, precision)] end.to_h.freeze
Class Method Summary collapse
-
.from_reference(value, precision) ⇒ Horologium::Numeric::TwoPartFloat, Horologium::Numeric::Exact
A TAI Julian Date, read in TT.
-
.to_reference(value, precision) ⇒ Horologium::Numeric::TwoPartFloat, Horologium::Numeric::Exact
A TT Julian Date, read back in TAI.
Methods inherited from Base
provenance, seconds_in_day, si_seconds_in_day, zone_designator
Class Method Details
.from_reference(value, precision) ⇒ Horologium::Numeric::TwoPartFloat, Horologium::Numeric::Exact
A TAI Julian Date, read in TT. It adds the 32.184 seconds.
44 45 46 |
# File 'lib/horologium/scales/tt.rb', line 44 def from_reference(value, precision) Numeric::Precision.add(value, offset(precision)) end |
.to_reference(value, precision) ⇒ Horologium::Numeric::TwoPartFloat, Horologium::Numeric::Exact
A TT Julian Date, read back in TAI. It removes the 32.184 seconds.
55 56 57 |
# File 'lib/horologium/scales/tt.rb', line 55 def to_reference(value, precision) Numeric::Precision.subtract(value, offset(precision)) end |