2 * @author alteredq / http://alteredqualia.com/
5 function Clock( autoStart ) {
7 this.autoStart = ( autoStart !== undefined ) ? autoStart : true;
17 Object.assign( Clock.prototype, {
21 this.startTime = ( typeof performance === 'undefined' ? Date : performance ).now(); // see #10732
23 this.oldTime = this.startTime;
31 this.getElapsedTime();
33 this.autoStart = false;
37 getElapsedTime: function () {
40 return this.elapsedTime;
44 getDelta: function () {
48 if ( this.autoStart && ! this.running ) {
57 var newTime = ( typeof performance === 'undefined' ? Date : performance ).now();
59 diff = ( newTime - this.oldTime ) / 1000;
60 this.oldTime = newTime;
62 this.elapsedTime += diff;