
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
ntp-packet-parser
Advanced tools
Library to parse NTP response packets according to RFC 5905 into a easy-to-use structure. It does not apply any validations or calculations regarding the time but solely parses the data.
See buffcode/ntp-time-sync for an implementation.
yarn add ntp-packet-parser
import { NtpPacketParser } from "ntp-packet-parser";
/** const udpPacket = new Buffer(...); **/
const result = NtpPacketParser.parse(udpPacket);
var NtpPacketParser = require("ntp-packet-parser").NtpPacketParser;
/** const udpPacket = new Buffer(...); **/
var result = NtpPacketParser.parse(udpPacket);
The response from NtpPacketParser.parse will return the following object structure:
| Property | Type | Description |
|---|---|---|
| leapIndicator | Integer | Warning of an impending leap second to be inserted or deleted in the last minute of the current month |
| version | Integer | NTP version number, currently 4 |
| mode | Integer | Request/response mode |
| stratum | Integer | Stratum of the server |
| poll | Integer | Integer representing the maximum interval in log2 seconds between successive messages (Note: you need to apply Math.pow(2, <value>) to get the real value) |
| precision | Integer | Integer representing the precision of the system clock in log2 seconds (Note: you need to apply Math.pow(2, <value>) to get the real value) |
| rootDelay | Date | Total round-trip delay to the reference clock |
| rootDispersion | Date | Total dispersion to the reference clock |
| referenceId | String | String to identify the particular server or reference clock |
| referenceTimestamp | Date | Time when the system clock was last set or corrected |
| originTimestamp | Date | Time at the client when the request departed for the server |
| receiveTimestamp | Date | Time at the server when the request arrived from the client |
| transmitTimestamp | Date | Time at the server when the response left for the client |
To get the relative time for any Date property, calculate the difference between "Jan 01 1900 GMT" and the given date.
let rootDelayInMilliseconds = result.rootDelay.getTime() - new Date("Jan 01 1900 GMT").getTime();
For further explanations on the possible values of these properties please refer to RFC 5909, Page 19ff.
Some tests regarding structure, response and error handling exist. To run them locally:
yarn test
Please file a PR against master.
FAQs
A parser for NTP UDP packets
The npm package ntp-packet-parser receives a total of 925 weekly downloads. As such, ntp-packet-parser popularity was classified as not popular.
We found that ntp-packet-parser demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.