Mercurial > jmeCapture
diff src/com/aurellem/capture/RatchetTimer.java @ 69:ddb300c5335f
fixed RatchetTimer time reporting.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Wed, 29 May 2013 17:15:41 -0400 |
parents | 155c70b7e6de |
children |
line wrap: on
line diff
1.1 --- a/src/com/aurellem/capture/RatchetTimer.java Thu Jul 19 12:28:55 2012 -0500 1.2 +++ b/src/com/aurellem/capture/RatchetTimer.java Wed May 29 17:15:41 2013 -0400 1.3 @@ -11,12 +11,12 @@ 1.4 */ 1.5 1.6 public class RatchetTimer extends Timer{ 1.7 - private float framerate; 1.8 + private long framerate; 1.9 private int ticks; 1.10 private long lastTime = 0; 1.11 1.12 public RatchetTimer(float framerate) { 1.13 - this.framerate = framerate; 1.14 + this.framerate = (long) framerate; 1.15 this.ticks = 0; 1.16 } 1.17 1.18 @@ -24,19 +24,19 @@ 1.19 * return time in milliseconds 1.20 */ 1.21 public long getTime() { 1.22 - return (long) (this.ticks * (1.0f / this.framerate) * 1000f); 1.23 + return ticks; 1.24 } 1.25 1.26 public long getResolution() { 1.27 - return 1000000000L; 1.28 + return framerate; 1.29 } 1.30 1.31 public float getFrameRate() { 1.32 - return this.framerate; 1.33 + return framerate; 1.34 } 1.35 1.36 public float getTimePerFrame() { 1.37 - return (float) (1.0f / this.framerate); 1.38 + return (float) (1.0f / framerate); 1.39 } 1.40 1.41 public void update() {