net.jinx.time
Class SteppingTimeSource

java.lang.Object
  extended by net.jinx.time.SteppingTimeSource
All Implemented Interfaces:
NanoTimeSource, TimeSource

public class SteppingTimeSource
extends java.lang.Object
implements NanoTimeSource

SteppingTimeSource is a TimeSource that is not real-time. It is instead based on an internal time accumulator clock.

Time is added to the accumulator using any of the step*() methods.

API Stability: Stable.


Constructor Summary
SteppingTimeSource()
           
 
Method Summary
 long getNanoseconds()
          Provides the number of nanoseconds that have accumulated on this SteppingTimeSource since it's creation.
 boolean isRealTime()
          Returns false.
 void stepMilliseconds(long milliseconds)
          Converts to nanoseconds and adds to the internal clock's value.
 void stepNanoseconds(long nanoseconds)
          Adds to the internal clock's value.
 void stepSeconds(double seconds)
          Converts to nanoseconds and adds to the internal clock's value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SteppingTimeSource

public SteppingTimeSource()
Method Detail

getNanoseconds

public long getNanoseconds()
Provides the number of nanoseconds that have accumulated on this SteppingTimeSource since it's creation.

Specified by:
getNanoseconds in interface NanoTimeSource
Returns:
the number of nanoseconds since the event.

isRealTime

public boolean isRealTime()
Returns false.

Specified by:
isRealTime in interface TimeSource
Returns:
false.

stepSeconds

public void stepSeconds(double seconds)
Converts to nanoseconds and adds to the internal clock's value.

Parameters:
seconds - the number of seconds to add.

stepMilliseconds

public void stepMilliseconds(long milliseconds)
Converts to nanoseconds and adds to the internal clock's value.

Parameters:
milliseconds - the number of milliseconds to add.

stepNanoseconds

public void stepNanoseconds(long nanoseconds)
Adds to the internal clock's value.

Parameters:
nanoseconds - the number of nanoseconds to add.