Skip to content

Instantly share code, notes, and snippets.

View nilsga's full-sized avatar

Nils-Helge Garli Hegvik nilsga

  • Biztek AS
  • Trondheim, Norway
View GitHub Profile
function MatchClock(match, callback) {
this.currentHalf = match.currentHalf || 0;
this.currentHalfOffset = match.currentHalfOffset || 0;
this.startTime = new Date(match.startTime);
this.paused = match.paused;
this.clockDiff = new Date().getTime() - new Date(match.serverTime).getTime();
this.callback = callback;
if(typeof this.paused !== "undefined" && !this.paused) {
this.start(this.callback);
}