ntpclient
TypeScript icon, indicating that this package has built-in type declarations

1.6.3 • Public • Published

NTPClient License: GPL v3 npm version

TypeScript implementation of the NTP Client Protocol. Based on node-ntp-client.

Prerequisites

Installation

ℹ️ This is a hybrid CommonJS / ESM module.

Run yarn add ntpclient or npm i ntpclient.

import {NTPClient} from 'ntpclient';

new NTPClient()
  .getNetworkTime()
  .then(date => console.log(date)) // 2017-09-20T15:29:09.443Z
  .catch(err => console.error(err));

// or

new NTPClient({
  server: 'de.pool.ntp.org',
  port: 123,
  replyTimeout: 40 * 1000, // 40 seconds
})
  .getNetworkTime()
  .then(date => console.log(date)) // 2017-09-20T15:29:09.443Z
  .catch(err => console.error(err));

// or

new NTPClient('de.pool.ntp.org', 123, 40 * 1000)
  .getNetworkTime()
  .then(date => console.log(date)) // 2017-09-20T15:29:09.443Z
  .catch(err => console.error(err));

/ntpclient/

    Package Sidebar

    Install

    npm i ntpclient

    Weekly Downloads

    441

    Version

    1.6.3

    License

    GPL-3.0

    Unpacked Size

    61.1 kB

    Total Files

    20

    Last publish

    Collaborators

    • ffflorian