Skip to content
This repository has been archived by the owner on Feb 17, 2023. It is now read-only.

AlexXanderGrib/ntp-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Promise based Net Time Protocol (NTP) client for NodeJS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published