org.as2lib.core.BasicClass +--org.as2lib.util.StopWatch
Stopwatch
stops the time.
Instantiate this class as follows:
import org.as2lib.util.StopWatch;
var stopWatch:StopWatch = new StopWatch();
This will create a still standing stopwatch. You can start and stop the
stopwatch to record time as you please.
stopWatch.start();
// Do something
stopWatch.stop();
The recored time is available in milliseconds and seconds.
trace(stopWatch.getTimeInMilliSeconds() + " ms");
trace(stopWatch.getTimeInSeconds() + " s");
new StopWatch()
public function start(Void):Void
Starts the time recording process.
IllegalStateException | if the stopwatch has already been started |
public function stop(Void):Void
Stops the time recording process if the process has been started before.
IllegalStateException | if the stopwatch has not been already started |
public function hasStarted(Void):Boolean
Returns whether this stopwatch has been started.
true
if this stopwatch has been started else false
public function getTimeInMilliSeconds(Void):Number
Calculates and returns the elapsed time in milliseconds.
This stopwatch will not be stopped by calling this method. If this stopwatch is still running it takes the current time as stoptime for the result.
the elapsed time in milliseconds
public function getTimeInSeconds(Void):Number
Calculates and returns the elapsed time in seconds.
This stopwatch will not be stopped by calling this method. If this stopwatch is still running it takes the current time as stoptime for the result.
the elapsed time in seconds
public function toString():String
Generates a string representation of this stopwatch that includes all start and stop times in milliseconds.
the string representation of this stopwatch
toString() in org.as2lib.core.BasicInterface