Browse Source

getElapsedTime() in TREE.Clock returns whole running time and not elapsed time from previous start. (#9692)

* getElapsedTime() returns whole running time

getElapsedTime() function returns incorrect value after stop() and start(), It returns whole working time from first run.
I changes adde this.elapsedTime = 0 in stop() function, so after next start() we can get correct elapsed time from last start()

Perhaps it's incorrect and suggested changes need new function, so Clock.js will have two functions:
- first one will return whole running time (as it is now)
- second will return elapsed time from last start

* Update Clock.js
Verokster 8 years ago
parent
commit
f9bd2395b9
1 changed files with 1 additions and 0 deletions
  1. 1 0
      src/core/Clock.js

+ 1 - 0
src/core/Clock.js

@@ -23,6 +23,7 @@ Clock.prototype = {
 		this.startTime = ( performance || Date ).now();
 		this.startTime = ( performance || Date ).now();
 
 
 		this.oldTime = this.startTime;
 		this.oldTime = this.startTime;
+		this.elapsedTime = 0;
 		this.running = true;
 		this.running = true;
 
 
 	},
 	},