# rinexWeekToUtc

Industry: GNSS

## Signature

```ts
rinexWeekToUtc(system: RinexWeekSystem, week: number, timeOfWeekSeconds: number): string
```

Convert a week number from a RINEX navigation file, and the seconds of that week, to a UTC instant string.

- A RINEX navigation record's week is a continuous count that never wraps. For GPS, QZSS, NavIC and Galileo records it counts from the GPS epoch, 1980-01-06 (RINEX 4.02 Table A30: "Continuous number, not mod (1024), counted from 1980 (same as GPS)"; Tables A9, A13, A19). A BeiDou record counts BDT weeks from 2006-01-01 (RINEX 4.02 §5.4.6, Table A23).
- CNAV/CNAV-2, BDS CNAV-1/2/3 and NavIC L1NV records have no week column: take the week from the record's epoch line.
- It is not the week a satellite broadcasts: a NavIC broadcast week counts from 1999 and wraps. Use `gnssWeekToUtc` for those.
- A full GPS week number from any other source is the same count, so `"GPS"` reads it too.
- GLONASS records carry no week number.
- A week time inside an inserted leap second returns `…T23:59:60Z`.
- `timeOfWeekSeconds` may have a fraction; it is rounded to the nearest nanosecond, and a value that rounds to 604 800 s returns "".
- "" for a negative or non-integer week, a time of week outside 0 up to 604 800, a time before the system's epoch (Galileo and NavIC time start on 1999-08-22, RINEX week 1024), a result past year 9999, and on invalid input.

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `system` | `RinexWeekSystem` | the RINEX record's system: "GPS", "GAL", "BDT", "QZS" or "IRN" |
| `week` | `number` | the record's week number |
| `timeOfWeekSeconds` | `number` | seconds since the start of the week, 0 up to but not including 604 800, rounded to the nearest nanosecond; a value that rounds to 604 800 s returns "" |

## Returns

ISO 8601 UTC instant string (`Z`), or "" on invalid input

## Related types

- [`RinexWeekSystem`](/gmt/reference/types/RinexWeekSystem/)

## Examples

```ts
import { rinexWeekToUtc } from "@northguild/gmt/gnss/convert";

rinexWeekToUtc("IRN", 2295, 86418) // "2024-01-01T00:00:00Z"
```

## Source

[gnss/convert/rinexWeekToUtc.ts](https://github.com/northguild/gmt/blob/main/packages/gmt/src/gnss/convert/rinexWeekToUtc.ts)
