Skip to content

Conversation

@SomKen
Copy link

@SomKen SomKen commented Dec 30, 2024

  • Update library to provide access to the stratum info of the given NTP server.
  • Updated Readme to include how to get just the time (existing example) and how to get the stratum info too.
  • Fix error in Node 22+ with buffer allocation (See below)
  • Add test for stratum

This package seems dead, but as it's still available via npm, I'm making this PR in hopes that it will be added to the main project. I'm happy to update anything else requested, but this is enough to get me going with my own project.

Node error seen in v22:

(node:60851) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `node --trace-deprecation ...` to show where the warning was created)

Unit test:

$ npm test

> ntp-client@0.5.4 test
> grunt jshint nodeunit

Running "jshint:gruntfile" (jshint) task
>> 1 file lint free.

Running "jshint:lib" (jshint) task
>> 1 file lint free.

Running "jshint:test" (jshint) task
>> 1 file lint free.

Running "nodeunit:files" (nodeunit) task
Testing ntp-client_test.js..
System reported : Sun Dec 29 2024 17:39:36 GMT-0800 (Pacific Standard Time)
NTP Reported : Sun Dec 29 2024 17:39:36 GMT-0800 (Pacific Standard Time)
.
System reported : Sun Dec 29 2024 17:39:36 GMT-0800 (Pacific Standard Time)
NTP Reported : Sun Dec 29 2024 17:39:36 GMT-0800 (Pacific Standard Time)
Stratum Reported : 2
..OK
>> 11 assertions passed (5186ms)

Done.

Include the stratum info for a given ntp server
- Update examples to add a stratum example
- Add self as contributor
- Update ntpdata to use Buffer.alloc
- Add stratum info to exports.demo
Add back removed comment
- Add stratum test
- Update version number
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant