org.globus.cog.util.ntp
Class NTPClient

java.lang.Object
  extended byorg.globus.cog.util.ntp.NTPClient

public class NTPClient
extends Object

A simple NTPClient based on the RFC2030.


Constructor Summary
NTPClient(String NTPserver)
          Creates a new NTPClient instance.
 
Method Summary
 String convertMode(int mode)
          Converts the mode as described in RFC2030.
 long getDelay()
          returns the delay between the remote server and the local time.
 String getMode()
          The mode as described in RFC2030.
 String getServer()
          Returns the NTP server name.
 String getType()
          Returns the type of the serevr.
 long getVariation()
          Describe getVariation method here.
 void update()
          queries the NTP serevr and calculates the time difference.
 boolean withinDelta(long delta)
          returns true if the timedelay is smaller than a specified value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NTPClient

public NTPClient(String NTPserver)
Creates a new NTPClient instance.

Parameters:
NTPserver - is the name of an ntpserver such as time.nist.gov
Method Detail

getMode

public String getMode()
The mode as described in RFC2030.

Returns:
a String returning a readble form of the mode. Mode Meaning ------------------------------------ 0 reserved 1 symmetric active 2 symmetric passive 3 client 4 server 5 broadcast 6 reserved for NTP control message 7 reserved for private use

convertMode

public String convertMode(int mode)
Converts the mode as described in RFC2030.

Returns:
a String returning a readble form of the mode. Mode Meaning ------------------------------------ 0 reserved 1 symmetric active 2 symmetric passive 3 client 4 server 5 broadcast 6 reserved for NTP control message 7 reserved for private use

getServer

public String getServer()
Returns the NTP server name.

Returns:
a String with the server name

getType

public String getType()
Returns the type of the serevr.

Returns:
a String with the type

getDelay

public long getDelay()
returns the delay between the remote server and the local time.

Returns:
a long value representing the difference in milliseconds.

getVariation

public long getVariation()
Describe getVariation method here.

Returns:
a long value

withinDelta

public boolean withinDelta(long delta)
returns true if the timedelay is smaller than a specified value.

Parameters:
delta - a long value representing the interval
Returns:
a boolean value returns true if the time difference is smaller than delta

update

public void update()
            throws IOException
queries the NTP serevr and calculates the time difference.

Throws:
IOException