de.jstacs.utils
Class Time

java.lang.Object
  extended by de.jstacs.utils.Time
Direct Known Subclasses:
RealTime, UserTime

public abstract class Time
extends Object

This interface is the framework for stopping the time of anything.

Author:
Jens Keilwagen

Constructor Summary
Time()
          Creates a new time object and starts the clock.
 
Method Summary
abstract  double getElapsedTime()
          Returns the elapsed time since invoking the constructor.
static Time getTimeInstance(OutputStream out)
          This method tries to return a UserTime instance, if not possible (due to native code) it returns a RealTime instance.
abstract  void reset()
          Restarts the time stopping.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Time

public Time()
Creates a new time object and starts the clock.

Method Detail

getElapsedTime

public abstract double getElapsedTime()
Returns the elapsed time since invoking the constructor.

Returns:
the elapsed time in seconds

reset

public abstract void reset()
Restarts the time stopping.


getTimeInstance

public static Time getTimeInstance(OutputStream out)
                            throws IOException
This method tries to return a UserTime instance, if not possible (due to native code) it returns a RealTime instance.

Parameters:
out - a stream that allows to write a warning if a RealTime instance is returned; can be null
Returns:
a UserTime or RealTime instance
Throws:
IOException - forwarded from OutputStream.write(byte[])