org.minetti.astrodevice.common.object
Class TimeSynchronization

java.lang.Object
  extended by org.minetti.astrodevice.common.object.TimeSynchronization
All Implemented Interfaces:
Serializable

public final class TimeSynchronization
extends Object
implements Serializable

Object containing all informations used for time synchronization. This is inspired of NTP protocol.

Author:
Jean-Philippe MINETTI
See Also:
Serialized Form

Constructor Summary
TimeSynchronization(long originateTime, long receiveTime, long transmitTime)
          Constructor.
 
Method Summary
 long computeRoundtripDelay(long clientReceiveTime)
          Computes and returns the round-trip delay time.
 long computeTimeOffset(long clientReceiveTime)
          Computes and returns the time offset between the client and the server.
 long getOriginateTime()
          Returns the start time of the request by the client (equivalent to the OT field of the NTP protocol).
 long getReceiveTime()
          Returns the receipt time of the request on the server (equivalent to the RT field of the NTP protocol).
 long getTransmitTime()
          Returns the transmission time of the response by the server (equivalent to the TT field of the NTP protocol).
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TimeSynchronization

public TimeSynchronization(long originateTime,
                           long receiveTime,
                           long transmitTime)
Constructor.

Parameters:
originateTime - Start time of the response (given by the client - clientTransmitTime).
receiveTime - Receipt time of the request.
transmitTime - Transmission time of the response.
Method Detail

getOriginateTime

public long getOriginateTime()
Returns the start time of the request by the client (equivalent to the OT field of the NTP protocol).

Returns:
Start time of the request.

getReceiveTime

public long getReceiveTime()
Returns the receipt time of the request on the server (equivalent to the RT field of the NTP protocol).

Returns:
Receipt time of the request.

getTransmitTime

public long getTransmitTime()
Returns the transmission time of the response by the server (equivalent to the TT field of the NTP protocol).

Returns:
Transmission time of the response.

computeTimeOffset

public long computeTimeOffset(long clientReceiveTime)
Computes and returns the time offset between the client and the server.

Parameters:
clientReceiveTime - Receipt time of the response on the client.
Returns:
Time offset between the client and the server.

computeRoundtripDelay

public long computeRoundtripDelay(long clientReceiveTime)
Computes and returns the round-trip delay time.

Parameters:
clientReceiveTime - Receipt time of the response on the client.
Returns:
Round-trip delay time.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2012 astroDevice. All Rights Reserved.