Comparing version 3.0.1 to 3.0.2
@@ -97,7 +97,3 @@ 'use strict'; | ||
const message = new Buffer(48); | ||
for (let i = 0; i < 48; ++i) { // Zero message | ||
message[i] = 0; | ||
} | ||
const message = Buffer.alloc(48); // Zero-filled message | ||
message[0] = (0 << 6) + (4 << 3) + (3 << 0); // Set version number to 4 and Mode to 3 (client) | ||
@@ -104,0 +100,0 @@ const sent = Date.now(); |
{ | ||
"name": "sntp", | ||
"description": "SNTP Client", | ||
"version": "3.0.1", | ||
"author": "Eran Hammer <eran@hammer.io> (http://hueniverse.com)", | ||
"version": "3.0.2", | ||
"repository": { | ||
@@ -16,9 +15,6 @@ "type": "git", | ||
], | ||
"engines": { | ||
"node": ">=8.9.0" | ||
}, | ||
"dependencies": { | ||
"boom": "7.x.x", | ||
"bounce": "1.x.x", | ||
"hoek": "5.x.x", | ||
"hoek": "6.x.x", | ||
"teamwork": "3.x.x" | ||
@@ -28,3 +24,3 @@ }, | ||
"code": "5.x.x", | ||
"lab": "15.x.x" | ||
"lab": "17.x.x" | ||
}, | ||
@@ -31,0 +27,0 @@ "scripts": { |
@@ -25,12 +25,16 @@ # sntp | ||
Sntp.time(options, function (err, time) { | ||
const exec = async function () { | ||
if (err) { | ||
try { | ||
const time = await Sntp.time(options); | ||
console.log('Local clock is off by: ' + time.t + ' milliseconds'); | ||
process.exit(0); | ||
} | ||
catch (err) { | ||
console.log('Failed: ' + err.message); | ||
process.exit(1); | ||
} | ||
}; | ||
console.log('Local clock is off by: ' + time.t + ' milliseconds'); | ||
process.exit(0); | ||
}); | ||
exec(); | ||
``` | ||
@@ -44,13 +48,14 @@ | ||
Sntp.offset(function (err, offset) { | ||
const exec = async function () { | ||
console.log(offset); // New (served fresh) | ||
const offset1 = await Sntp.offset(); | ||
console.log(offset1); // New (served fresh) | ||
// Request offset again | ||
Sntp.offset(function (err, offset) { | ||
const offset2 = await Sntp.offset(); | ||
console.log(offset2); // Identical (served from cache) | ||
}; | ||
console.log(offset); // Identical (served from cache) | ||
}); | ||
}); | ||
exec(); | ||
``` | ||
@@ -64,8 +69,10 @@ | ||
Sntp.start(function () { | ||
const exec = async function () { | ||
await Sntp.start(); | ||
var now = Sntp.now(); // With offset | ||
Sntp.stop(); | ||
}); | ||
}; | ||
exec(); | ||
``` | ||
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
76
13544
262
3
- Removedhoek@5.0.4(transitive)
Updatedhoek@6.x.x