@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.
40 lines (39 loc) • 1.13 kB
JavaScript
// src/internal/rinexWeek.ts
/**
* Epoch label of each RINEX navigation record's continuous week count (RINEX 4.02). The count
* never wraps, so it has no modulus and no era. Each `epochLabel` is
* `Temporal.PlainDateTime.from(<label>).toZonedDateTime("UTC").epochNanoseconds` of the label in
* its comment; rinexWeek.test.ts asserts each one.
*/
const RINEX_WEEK_EPOCHS = Object.freeze({
GPS: Object.freeze({
system: "GPS",
epochLabel: 315964800000000000n
}),
GAL: Object.freeze({
system: "GAL",
epochLabel: 315964800000000000n
}),
BDT: Object.freeze({
system: "BDT",
epochLabel: 1136073600000000000n
}),
QZS: Object.freeze({
system: "QZS",
epochLabel: 315964800000000000n
}),
IRN: Object.freeze({
system: "IRN",
epochLabel: 315964800000000000n
})
});
/**
* Whether a value names a system whose RINEX navigation records carry a week number.
*
* @param value candidate system
* @returns true for `GPS`, `GAL`, `BDT`, `QZS` or `IRN`
*/
function isRinexWeekSystem(value) {
return typeof value === "string" && Object.hasOwn(RINEX_WEEK_EPOCHS, value);
}
export { RINEX_WEEK_EPOCHS, isRinexWeekSystem };