Holger's Java API

## com.antelmann.calendar
Class TimeProtocolClient

    java.lang.Object
      com.antelmann.calendar.TimeProtocolClient

All Implemented Interfaces:
  TimeSystem

Deprecated. use `NTPClient` instead

    @Deprecated
    public class TimeProtocolClient

extends Object
implements TimeSystem

implements the TimeProtocol. This simple implementation is based on a single server.

Author:
  Holger Antelmann
See Also:
  `TimeProtocolServer`, `AtomicTime`, `NTPClient`

Field Summary
`static int` `DEFAULT_PORT` Deprecated. 37
`static String` `DEFAULT_SERVER` Deprecated. 0.pool.ntp.org
`protected static String[]` `knownServerList` Deprecated. a small list of known servers besides the default one

Fields inherited from interface com.antelmann.calendar.TimeSystem
`SYSTEM_TIME`

Constructor Summary
`TimeProtocolClient()` Deprecated. uses time-b.nist.gov
`TimeProtocolClient(String serverName)` Deprecated. uses the standard port 37
`TimeProtocolClient(String serverName, int port)` Deprecated.

Method Summary
`int` `adjustDelta()` Deprecated. adjusts the delta value used for `getTime()` through using the server time
`TimerTask` `createTimerTask(Logger logger)` Deprecated. creates a TimerTask that will adjust the delta and log the result to the given logger.
`int` `currentDelta()` Deprecated. returns the current difference between system time and atomic time in milliseconds.
`long` `currentTimeMillis()` Deprecated. returns the system time adjusted by the delta value.
`long` `currentTimeMillisOnline()` Deprecated. returns the current time in the current locale retrieved directly from the server.
`Calendar` `getCalendar()` Deprecated. returns the calendar used to localize the time
`int` `getDelta()` Deprecated. returns the stored difference between system time and atomic time in milliseconds.
`static String[]` `getKnownServerList()` Deprecated.
`long` `getLastDeltaAdjustmentTime()` Deprecated. returns the system time when `adjustDelta()` has been successfully called last time.
`int` `getPort()` Deprecated.
`String` `getServer()` Deprecated.
`int` `getTimeout()` Deprecated.
`static void` `main(String[] args)` Deprecated. console based demo app displaying the delta between the system time and the server
`protected int` `secondsSince1900()` Deprecated. returns the raw int directly from the server
`protected int` `secondsSince1900Udp()` Deprecated.
`protected int` `secondsSince190OTcp()` Deprecated.
`void` `setDelta(int delta)` Deprecated. manually sets the value used to adjust system time
`static void` `setKnownServerList(String[] newList)` Deprecated.
`void` `setPort(int port)` Deprecated.
`void` `setServer(String serverName)` Deprecated.
`void` `setTcp(boolean flag)` Deprecated.
`void` `setTimeout(int timeout)` Deprecated.
`String` `toString()` Deprecated.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### DEFAULT_SERVER

    public static final String DEFAULT_SERVER

  Deprecated.
  0.pool.ntp.org

  See Also:
    Constant Field Values

### DEFAULT_PORT

    public static final int DEFAULT_PORT

  Deprecated.
  37

  See Also:
    Constant Field Values

### knownServerList

    protected static String[] knownServerList

  Deprecated.
  a small list of known servers besides the default one

Constructor Detail

### TimeProtocolClient

    public TimeProtocolClient()

  Deprecated.
  uses time-b.nist.gov

### TimeProtocolClient

    public TimeProtocolClient(String serverName)

  Deprecated.
  uses the standard port 37

### TimeProtocolClient

    public TimeProtocolClient(String serverName,
                              int port)

  Deprecated.

Method Detail

### getKnownServerList

    public static String[] getKnownServerList()

  Deprecated.

### setKnownServerList

    public static void setKnownServerList(String[] newList)

  Deprecated.

### setTcp

    public void setTcp(boolean flag)

  Deprecated.

### getServer

    public String getServer()

  Deprecated.

### setServer

    public void setServer(String serverName)

  Deprecated.

### getPort

    public int getPort()

  Deprecated.

### setPort

    public void setPort(int port)

  Deprecated.

### setTimeout

    public void setTimeout(int timeout)

  Deprecated.

### getTimeout

    public int getTimeout()

  Deprecated.

### getCalendar

    public Calendar getCalendar()

  Deprecated.
  returns the calendar used to localize the time

### currentTimeMillis

    public long currentTimeMillis()

  Deprecated.
  returns the system time adjusted by the delta value. This is generally the proper method to be called by the application.

  Specified by:
    `currentTimeMillis` in interface `TimeSystem`
  Returns:
    the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC.

### secondsSince1900

    protected int secondsSince1900()
                            throws IOException

  Deprecated.
  returns the raw int directly from the server

  Throws:
    `IOException`

### secondsSince1900Udp

    protected int secondsSince1900Udp()
                               throws IOException

  Deprecated.
  Throws:
    `IOException`

### secondsSince190OTcp

    protected int secondsSince190OTcp()
                               throws IOException

  Deprecated.
  Throws:
    `IOException`

### currentTimeMillisOnline

    public long currentTimeMillisOnline()
                                 throws IOException

  Deprecated.
  returns the current time in the current locale retrieved directly from the server. Calling this method does not affect the delta value of this instance.

  Throws:
    `IOException`

### currentDelta

    public int currentDelta()
                     throws IOException

  Deprecated.
  returns the current difference between system time and atomic time in milliseconds. A negative number indicates that the system clock is behind. Calling this method does not affect the delta value of this instance.

  Throws:
    `IOException`

### getDelta

    public int getDelta()

  Deprecated.
  returns the stored difference between system time and atomic time in milliseconds. A negative number indicates that the system clock is behind.

  See Also:
    `adjustDelta()`, `setDelta(int)`

### setDelta

    public void setDelta(int delta)

  Deprecated.
  manually sets the value used to adjust system time

  See Also:
    `adjustDelta()`

### getLastDeltaAdjustmentTime

    public long getLastDeltaAdjustmentTime()

  Deprecated.
  returns the system time when `adjustDelta()` has been successfully called last time. If no successful adjustment has taken place, yet, the method returns 0.

  See Also:
    `adjustDelta()`

### adjustDelta

    public int adjustDelta()
                    throws IOException

  Deprecated.
  adjusts the delta value used for `getTime()` through using the server time

  Throws:
    `IOException`
  See Also:
    `currentTimeMillis()`, `getDelta()`, `setDelta(int)`, `getLastDeltaAdjustmentTime()`

### createTimerTask

    public TimerTask createTimerTask(Logger logger)

  Deprecated.
  creates a TimerTask that will adjust the delta and log the result to the given logger. The logger may be null.

  See Also:
    `adjustDelta()`, `Timer`

### toString

    public String toString()

  Deprecated.
  Overrides:
    `toString` in class `Object`

### main

    public static void main(String[] args)
                     throws IOException

  Deprecated.
  console based demo app displaying the delta between the system time and the server

  Throws:
    `IOException`

(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads