ntp-client-promise
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

Net Time Protocol Client

Query time from NTP servers

Import

  • CommonJS
    const { getTime } = require("ntp-client-promise")
  • TypeScript
    import { getTime } from "ntp-client-promise"
  • ES Modules
    import ntp from "ntp-client-promise"
    const getTime = ntp.getTime;

Usage

const date = await getTime()
date // => 2022-09-02T19:21:33.186Z

const russianTime = await getTime({
  // Everything is optional
  
  server: "ntp5.stratum2.ru", 
  port: 123, // 123 is default NTP port
  timeout: 1000, // timeout in MS
  socketType: "udp6", // udp4 or udp6 - which IP type to use
  utc: false // sync with UTC time (default) or local
})

/ntp-client-promise/

    Package Sidebar

    Install

    npm i ntp-client-promise

    Weekly Downloads

    2

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    5.04 kB

    Total Files

    4

    Last publish

    Collaborators

    • alexxandergrib
    • gumusaliny