moonpyk / node-ntp-client Goto Github PK
View Code? Open in Web Editor NEWPure Javascript implementation of the NTP Client Protocol
License: MIT License
Pure Javascript implementation of the NTP Client Protocol
License: MIT License
Presumably the error event (from DNS I think) should be passed on to the callback. It makes this library un-usable as it causes the whole app to crash out. This is with using a non-existant hostname:
$ node lib/entities/Ntp.js
{ [Error: getaddrinfo EIO] code: 'EIO', errno: 'EIO', syscall: 'getaddrinfo' }
events.js:72
throw er; // Unhandled 'error' event
^
Error: getaddrinfo EIO
at errnoException (dns.js:37:11)
at Object.onanswer [as oncomplete] (dns.js:124:16)
If the dgram client errors, the callback receives an Error
object, but if there is a timeout a String
gets passed as the error callback which makes appropriate error handling a real pain:
https://github.com/moonpyk/node-ntp-client/blob/master/lib/ntp-client.js#L52
I'd like to sync many browsers
If connection gets closed due to external event
error is experienced after attempt to send 'ntpData'.
Connection should be only closed if open :)
Details:
dgram.js:420
throw new Error('Not running'); // error message from dgram_legacy.js
^
Error: Not running
at Socket._healthCheck (dgram.js:420:11)
at Socket.close (dgram.js:327:8)
at /opt/cos-medico/new/node_modules/ntp-client/lib/ntp-client.js:80:24
at dgram.js:297:21
at asyncCallback (dns.js:68:16)
at Object.onanswer [as oncomplete] (dns.js:124:7)
we know actually it aint a front end tech~ yes, we mean nodejs.
I think that's how normal ntp works
Just ignore a value if it is not in the range [Q1-k(Q3-Q1),Q3+k(Q3-Q1)], where Q1 and Q3 are the 25th and 75th percentiles, k is a constant and to calculate a percentile you just do:
data_set = data_set.sort();
for (var i=0;i<data_set.length;i++){
if (i>=data_set.length*percentile/100){
answer = data_set[i];
break;
}
}
Yes, I just read all that on wikipedia
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.