networkClock
Class NetworkClockController

java.lang.Object
  extended by networkClock.NetworkClockController
All Implemented Interfaces:
NetworkClockInterface

public class NetworkClockController
extends java.lang.Object
implements NetworkClockInterface

Controller class of component NetworkClock.

Provides a clock, which can be synchronized with a SNTP server (See RFC 2030 for further information).

Can retrieve SNTP messages from a SNTP server at regular intervals and calculate the local clock's offset each time. The local clock's offset calculation is implemented according to the SNTP algorithm specified in RFC 2030.

The method getTime() can be used to generate timestamps (The typical accuracy of a SNTP client/server exchange is fractions of a second).

The System's time is never changed.

Uses Adam Buckley's class NtpMessage as message format.

Author:
Karl-Peter Fuchs
See Also:
NtpMessage

Constructor Summary
NetworkClockController()
          Generates a new NetworkClock component which provides a clock, synchronized with a SNTP server.
 
Method Summary
 long getTime()
          Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT (The typical accuracy of a SNTP client/server exchange is fractions of a second.)
 void initialize()
          Initializes the this component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NetworkClockController

public NetworkClockController()
Generates a new NetworkClock component which provides a clock, synchronized with a SNTP server.

Method Detail

initialize

public void initialize()
Initializes the this component.


getTime

public long getTime()
Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT (The typical accuracy of a SNTP client/server exchange is fractions of a second.)

Specified by:
getTime in interface NetworkClockInterface
Returns:
The number of milliseconds since January 1, 1970, 00:00:00 GMT.