Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
daslyfe committed Aug 9, 2024
1 parent 4ca8279 commit c54b33e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions packages/core/neocyclist.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,24 @@ export class NeoCyclist {
this.worker_time_dif = time_dif;
return;
}
const secondsBetweenDiffChecks = 1.5;
const secondsBetweenDiffChecks = 1.5;
// do nothing if interval has not passed yet
if (prevWorkerTimeDiffs.length >= sampleLength && Math.abs(time - timeAtPrevDiffSample) < secondsBetweenDiffChecks) {
if (
prevWorkerTimeDiffs.length >= sampleLength &&
Math.abs(time - timeAtPrevDiffSample) < secondsBetweenDiffChecks
) {
return;
}


const rollingWorkerTimeDiff = averageArray(prevWorkerTimeDiffs);

// how far the clock can drift before being corrected
const driftDelta = 0.002;
const driftDelta = 0.003;

if (Math.abs(rollingWorkerTimeDiff - this.worker_time_dif) < driftDelta) {
return;
}
console.info(Math.abs(rollingWorkerTimeDiff - this.worker_time_dif))


timeAtPrevDiffSample = time;
this.worker_time_dif = rollingWorkerTimeDiff;
};
Expand Down

0 comments on commit c54b33e

Please sign in to comment.