You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

ntp-client-promise

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ntp-client-promise

Query time from NTP servers with promises

1.1.0
latest
Source
npm
Version published
Weekly downloads
3
-57.14%
Maintainers
2
Weekly downloads
 
Created
Source

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
})

Keywords

backend

FAQs

Package last updated on 02 Sep 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts