org.apache.qpid.test.framework.clocksynch
Interface ClockSynchronizer

All Known Implementing Classes:
LocalClockSynchronizer, UDPClockSynchronizer

public interface ClockSynchronizer

ClockSynchronizer provides an interface through which two nodes may synchronize their clocks. It is expected that one node will act as the reference clock, to which no delta need be applied, and the other node will act as the slave, and which must apply a delta to its local clock to get a clock synchronized with the reference.

The slave side will initiate the computation of a clock delta by calling the synch() method. This method will not return until the delta has been computed, at which point there is a method to return its value, as well as an estimate of the likely error (usually one standard deviation), in the synchronization. For convenience there is a nanoTime() method to return the value of System.nanoTime() with the delta added in.

CRC Card
Responsibilities Collaborations
Trigger a clock synchronization.
Compute a clock delta to apply to the local clock.
Estimate the error in the synchronzation.


Method Summary
 long getDelta()
          Gets the clock delta in nano seconds.
 long getEpsilon()
          Gets an estimate of the clock error in nan seconds.
 long nanoTime()
          Gets the local clock time with any computed delta added in.
 void synch()
          The slave side should call this to copute a clock delta with the reference.
 

Method Detail

synch

void synch()
           throws ClockSynchFailureException
The slave side should call this to copute a clock delta with the reference.

Throws:
ClockSynchFailureException - If synchronization cannot be achieved.

getDelta

long getDelta()
Gets the clock delta in nano seconds.

Returns:
The clock delta in nano seconds.

getEpsilon

long getEpsilon()
Gets an estimate of the clock error in nan seconds.

Returns:
An estimate of the clock error in nan seconds.

nanoTime

long nanoTime()
Gets the local clock time with any computed delta added in.

Returns:
The local clock time with any computed delta added in.


Licensed to the Apache Software Foundation