UNPKG

@northguild/gmt

Version:

Date and time library for JavaScript and TypeScript, built on TC39 Temporal: time zones, DST, business days, ISO 8601 strings in and out. Never throws.

54 lines • 2.51 kB
import { UtcReading } from "./utcReading.js"; import { LeapSecondSteps } from "./leapSeconds.js"; /** * Terrestrial Time (TT) and Geocentric Coordinate Time (TCG) from the TAI hinge. * * Sources: IERS Conventions (2010), TN 36 §10.1 eq. (10.1); IAU 2000 Resolution B1.9. Pure bigint * nanoseconds: no Temporal call, nothing at import, no loop of its own. No Julian Date is * computed: eq. (10.1)'s `(JD_TT − T₀) × 86400` is TT nanoseconds since the TT label of * 1977-01-01T00:00:00 TAI. */ /** TT − TAI, exactly 32.184 s (IERS TN 36 §10.1, p. 151). */ export declare const TT_MINUS_TAI_NANOSECONDS = 32184000000n; /** * The TT label of 1977-01-01T00:00:00 TAI, where TCG and TT read the same: * 1977-01-01T00:00:32.184 as UTC-style epoch nanoseconds (TN 36 eq. 10.1; T₀ = 2443144.5003725 * is this instant as a TT Julian Date). */ export declare const TCG_TT_EPOCH_NANOSECONDS = 220924832184000000n; /** L_G numerator: L_G = 6.969290134 × 10⁻¹⁰ (IAU 2000 B1.9) is `L_G_NUMERATOR / L_G_DENOMINATOR`. */ export declare const L_G_NUMERATOR = 6969290134n; /** L_G denominator, 10^19, so that `L_G_NUMERATOR / L_G_DENOMINATOR` is L_G exactly. */ export declare const L_G_DENOMINATOR = 10000000000000000000n; /** * TT label nanoseconds of a UTC reading. * * @param steps the leap-second table * @param reading the UTC reading * @returns TT nanoseconds, or null where `taiOfUtc` is null */ export declare function ttOfUtc(steps: LeapSecondSteps, reading: UtcReading): bigint | null; /** * The UTC reading of a TT label. * * @param steps the leap-second table * @param tt TT label nanoseconds * @returns the UTC reading, or null before 1972-01-01T00:00:42.184 TT */ export declare function utcOfTt(steps: LeapSecondSteps, tt: bigint): UtcReading | null; /** * TCG − TT at a TT label, in nanoseconds, floored toward −∞: `d × L_G / (1 − L_G)` with `d` the TT * nanoseconds since the epoch (TN 36 eq. 10.1, exact rate). * * @param tt TT label nanoseconds * @returns the offset in nanoseconds */ export declare function tcgMinusTtNanoseconds(tt: bigint): bigint; /** * The TT label of a TCG label: TT = TCG − L_G × (TCG − T₀), solved from dTT/dTCG = 1 − L_G (IAU * 2000 B1.9) with T₀ from IERS TN 36 eq. (10.1); the floor is GMT's nanosecond rule. Exact inverse of `tt + tcgMinusTtNanoseconds(tt)` for every TT nanosecond. * * @param tcg TCG label nanoseconds * @returns TT label nanoseconds */ export declare function ttOfTcg(tcg: bigint): bigint;