Title: Timer
Course: CPS 261: Advanced Java Concepts ~ DL & MM MASTER

Timer.java for Performance Calculations




public class Timer {
    private long startingTime; // milliseconds
    private long stoppingTime; // milliseconds;

    public void start()
    {
        startingTime = System.currentTimeMillis();
    }
    public void stop()
    {
        stoppingTime = System.currentTimeMillis();
    }

    public double time()
    {
        return (stoppingTime - startingTime)/1000.0;
    }

}



Last Updated:

November 8, 2013 3:47 PM