timedata: minor.

This commit is contained in:
Christopher Jeffrey 2017-07-20 01:09:52 -07:00
parent bd56c75d0d
commit a11a1ab4ad
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -7,8 +7,8 @@
'use strict';
const util = require('../utils/util');
const EventEmitter = require('events');
const util = require('../utils/util');
/**
* An object which handles "adjusted time". This may not
@ -37,7 +37,7 @@ function TimeData(limit) {
this.known = new Map();
this.limit = limit;
this.offset = 0;
this._checked = false;
this.checked = false;
}
util.inherits(TimeData, EventEmitter);
@ -70,7 +70,7 @@ TimeData.prototype.add = function add(id, time) {
this.offset = median;
} else {
this.offset = 0;
if (!this._checked) {
if (!this.checked) {
let match = false;
for (let offset of this.samples) {
if (offset !== 0 && Math.abs(offset) < 5 * 60) {
@ -79,7 +79,7 @@ TimeData.prototype.add = function add(id, time) {
}
}
if (!match) {
this._checked = true;
this.checked = true;
this.emit('mismatch');
}
}