dawrehxyz icon

gameclock

dawrehxyz | PRO | 08/06/16 08:46:19 PM UTC | 0 ⭐ | 318 👁️ | Never ⏰ | []
Java |

710 B

|

None

|

0 👍

/

0 👎

package com.dawreh.wickeddreams.main;
 
/**
 * Created by Dawood on 2016-08-05.
 */
public class GameClock
{
    private long t0;
    private long t1;
    private long elapsedTime;
    private final long nanoSecond = 1000000000;
    private final long gamePlayRate = 1000000000/30;
 
    public long Initialize()
    {
        t0 = System.nanoTime();
        return t0;
    }
 
    public long CalculateElapsedTimeNS()
    {
        t1 = System.nanoTime();
        elapsedTime = t1 - t0;
        t0 = t1;
        return elapsedTime;
    }
 
    public long getGamePlayRate()
    {
        return gamePlayRate;
    }
 
    public long getCurrentTime()
    {
        return System.nanoTime();
    }
}

Comments