changeset 69:ddb300c5335f

fixed RatchetTimer time reporting.
author Robert McIntyre <rlm@mit.edu>
date Wed, 29 May 2013 17:15:41 -0400
parents 302d5e9ad120
children a67aef438383
files src/com/aurellem/capture/IsoTimer.java src/com/aurellem/capture/RatchetTimer.java
diffstat 2 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/src/com/aurellem/capture/IsoTimer.java	Thu Jul 19 12:28:55 2012 -0500
     1.2 +++ b/src/com/aurellem/capture/IsoTimer.java	Wed May 29 17:15:41 2013 -0400
     1.3 @@ -49,15 +49,15 @@
     1.4  	}
     1.5  
     1.6  	public long getResolution() {
     1.7 -		return (long) framerate;
     1.8 +		return framerate;
     1.9  	}
    1.10  
    1.11  	public float getFrameRate() {
    1.12 -		return this.framerate;
    1.13 +		return framerate;
    1.14  	}
    1.15  
    1.16  	public float getTimePerFrame() {
    1.17 -		return (float) (1.0f / this.framerate);
    1.18 +		return (float) (1.0f / framerate);
    1.19  	}
    1.20  
    1.21  	public void update() {this.ticks++;}
     2.1 --- a/src/com/aurellem/capture/RatchetTimer.java	Thu Jul 19 12:28:55 2012 -0500
     2.2 +++ b/src/com/aurellem/capture/RatchetTimer.java	Wed May 29 17:15:41 2013 -0400
     2.3 @@ -11,12 +11,12 @@
     2.4   */
     2.5  
     2.6  public class RatchetTimer extends Timer{
     2.7 -	private float framerate;
     2.8 +    private long framerate;
     2.9      private int ticks;
    2.10      private long lastTime = 0;
    2.11  
    2.12      public RatchetTimer(float framerate) {
    2.13 -        this.framerate = framerate;
    2.14 +        this.framerate = (long) framerate;
    2.15          this.ticks = 0;
    2.16      }
    2.17      
    2.18 @@ -24,19 +24,19 @@
    2.19       * return time in milliseconds
    2.20       */
    2.21      public long getTime() {
    2.22 -        return (long) (this.ticks * (1.0f / this.framerate) * 1000f);
    2.23 +	return ticks;
    2.24      }
    2.25  
    2.26      public long getResolution() {
    2.27 -        return 1000000000L;
    2.28 +	return framerate;
    2.29      }
    2.30  
    2.31      public float getFrameRate() {
    2.32 -        return this.framerate;
    2.33 +        return framerate;
    2.34      }
    2.35  
    2.36      public float getTimePerFrame() {
    2.37 -        return (float) (1.0f / this.framerate);
    2.38 +        return (float) (1.0f / framerate);
    2.39      }
    2.40  
    2.41      public void update() {