convertTimeScalefunction
A moment on one time scale as the same moment on another, in milliseconds since 1970 read on the target scale's own clock. UTC to TT is the leap seconds plus 32.184 s from 1972 and delta T before;
UT1 needs dut1 (UT1 minus UTC, from the IERS) and is UTC when it is left out, which is within 0.9 s; the TDB term is under 2 ms.
Import it
import { convertTimeScale } from "@johnmorrisdotca/wakusei-planets/time";
Definition
function convertTimeScale(when: When, from: TimeScale, to: TimeScale, options?: { dut1?: number; }): number
Parameters
| Name | Type | Description |
|---|---|---|
when | When | A |
from | TimeScale | The scale it is on. |
to | TimeScale | The scale wanted. |
options (optional) | { dut1?: number; } |
|
Returns
number
Milliseconds since 1970 on the to scale.
Examples
import { convertTimeScale } from "@johnmorrisdotca/wakusei-planets/time";
const utc = Date.UTC(2026, 10, 7, 12);
console.log((convertTimeScale(utc, "utc", "tt") - utc) / 1000, (convertTimeScale(utc, "utc", "gps") - utc) / 1000);69.184 18What it prints (run when this page was built)