You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
isso/isso/js/app/globals.js

22 lines
483 B

define(function() {
"use strict";
var Offset = function() {
this.values = [];
};
Offset.prototype.update = function(remoteTime) {
this.values.push((new Date()).getTime() - remoteTime.getTime());
};
Offset.prototype.localTime = function() {
return new Date((new Date()).getTime() - this.values.reduce(
function(a, b) { return a + b; }) / this.values.length);
};
return {
offset: new Offset()
};
});