fix a bug
This commit is contained in:
parent
b937a0f0f9
commit
fd31d9f2c7
8
index.js
8
index.js
|
@ -85,6 +85,10 @@ function sleep(ms) {
|
|||
|
||||
Promise.all(resps).catch(e => {});
|
||||
|
||||
if (!foundChange) {
|
||||
throw new Error("The remote clock does not work.");
|
||||
}
|
||||
|
||||
let firstReq = [await (resps[0])].map(res => ({
|
||||
remoteTime: res.date.getTime()/1000,
|
||||
beginTime: res.madeAt.getTime()/1000,
|
||||
|
@ -104,10 +108,6 @@ function sleep(ms) {
|
|||
"s) detected, reported result may be inaccurate.");
|
||||
}
|
||||
|
||||
if (!foundChange) {
|
||||
throw new Error("The remote clock does not work.");
|
||||
}
|
||||
|
||||
let diff = (foundChange.remoteTime - (foundChange.beginTime + foundChange.endTime) / 2);
|
||||
|
||||
console.log("remote_time = local_time "+(diff < 0 ? "-" : "+")+" " + Math.abs(Math.round(diff*1000)/1000)+ " s");
|
||||
|
|
Loading…
Reference in a new issue