ntpclient

1.8.0 • 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 pure 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));

Readme

Keywords

none

Package Sidebar

Install

npm i ntpclient

Weekly Downloads

245

Version

1.8.0

License

GPL-3.0

Unpacked Size

43 kB

Total Files

7

Last publish

Collaborators

  • ffflorian