# PtpTimestamp

Industry: IoT

:::caution[Unreleased]
Not in `@northguild/gmt` 1.21.0 on npm yet. It is on `main` and ships in the next release.
:::

A PTP (IEEE 1588) timestamp: 32 bits of nanoseconds and 48 bits (80 - 32) of whole seconds, 80 bits in all (RFC 8877 section 4.3).

```ts
import type { PtpTimestamp } from "@northguild/gmt";
```

## Members

| Member | Type | Description |
| --- | --- | --- |
| `seconds` | `bigint` | Whole TAI seconds since 1970-01-01T00:00:00 TAI: an integer from 0 to 2^48 - 1. |
| `nanoseconds` | `number` | Nanoseconds past `seconds`: an integer from 0 to 999 999 999. |

## Definition

```ts
interface PtpTimestamp {
  /** Whole TAI seconds since 1970-01-01T00:00:00 TAI: an integer from 0 to 2^48 - 1. */
  seconds: bigint;
  /** Nanoseconds past `seconds`: an integer from 0 to 999 999 999. */
  nanoseconds: number;
}
```

## Used by

- [`isValidPtpTimestamp`](/gmt/reference/iot/validate/isValidPtpTimestamp/)
- [`ptpToUtc`](/gmt/reference/iot/convert/ptpToUtc/)
- [`utcToPtp`](/gmt/reference/iot/convert/utcToPtp/)

## Source

[types/ptp.ts](https://github.com/northguild/gmt/blob/main/packages/gmt/src/types/ptp.ts)
