# @types/ntp-client

> TypeScript definitions for ntp-client

Latest version **0.5.0** (published 2023-11-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/ntp-client
pnpm add @types/ntp-client
yarn add @types/ntp-client
bun add @types/ntp-client
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.5.0 |
| Published | 2023-11-10 |
| First published | 2023-11-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51436 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/ntp-client
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/ntp-client
- npm.io page: https://npm.io/package/@types/ntp-client

## Recent versions

- 0.5.0 (latest) — 2023-11-10

## README

# Installation
> `npm install --save @types/ntp-client`

# Summary
This package contains type definitions for ntp-client (https://github.com/moonpyk/node-ntp-client).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/ntp-client.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/ntp-client/index.d.ts)
````ts
/** Default NTP port. Defaults to `123` */
export let defaultNtpPort: number;
/** Default NTP server. Defaults to `pool.ntp.org` */
export let defaultNtpServer: string;

/** The default timeout for NTP replies in milliseconds. Defaults to 10000 */
export let ntpReplyTimeout: number;

/**
 * Tries to retrieve the current time and date from an NTP server.
 * This function contacts the given NTP server on the given port and tries to
 * retrieve the current time and date. Upon success, the given callback
 * function is invoked and a date object is passed as second argument. If an
 * error occurs, the error is passed as first argument to the callback
 * function.
 * If either the param `server` or `port` are null or undefined, the default
 * NTP server or port, given by `defaultNtpServer` or `defaultNtpPort`
 * respectively, are used.
 *
 * @param server NTP to contact. If this value is null, the default NTP server is used
 * @param port Port to contact on NTP server. If this value is null, the default NTP port is used
 * @param callback Callback which is invoked on success or error. If the first param is not null, an
 * an error has occurred and the param contains the error. If it is null, the second param contains
 * the current time that was retrieved from the NTP server
 */
export function getNetworkTime(
    server: string | null | undefined,
    port: number | null | undefined,
    callback: (err: Error | string | null, date: Date | null) => void,
): void;

/**
 * Requests the current time from the default NTP server on the default port.
 *
 * This function is intended for demonstration purposes. It requests the
 * current time from the default NTP server using the default port and prints
 * it to the console. In case of an error, the error is also printed to the
 * console.
 *
 * @param argv Parameter vector. This value is ignored
 */
export function demo(...argv: any[]): void;

````

### Additional Details
 * Last updated: Fri, 10 Nov 2023 18:36:08 GMT
 * Dependencies: none

# Credits
These definitions were written by [Thomas Röggla](https://github.com/troeggla).

---
_Source: https://npm.io/package/@types/ntp-client · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
