net.i2p.time

## Class Timestamper

- java.lang.Object
- - net.i2p.time.Timestamper

- All Implemented Interfaces:
    Runnable

      public class Timestamper
      extends Object
      implements Runnable

  Periodically query a series of NTP servers and update any associated listeners. It tries the NTP servers in order, contacting them using SNTP (UDP port 123). By default, it does this every 5 minutes, forever.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `Timestamper.UpdateListener` Interface to receive update notifications for when we query the time Only used by Clock.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `PROP_CONCURRING_SERVERS`
    `static String` | `PROP_DISABLED`
    `static String` | `PROP_IP_COUNTRY`
    `static String` | `PROP_QUERY_FREQUENCY`
    `static String` | `PROP_SERVER_LIST`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Timestamper(I2PAppContext ctx)`
    `Timestamper(I2PAppContext ctx, Timestamper.UpdateListener lsnr)`
    `Timestamper(I2PAppContext ctx, Timestamper.UpdateListener lsnr, boolean daemon)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addListener(Timestamper.UpdateListener lsnr)`
    `boolean` | `getIsDisabled()`
    `Timestamper.UpdateListener` | `getListener(int index)`
    `int` | `getListenerCount()`
    `int` | `getQueryFrequencyMs()`
    `String` | `getServer(int index)`
    `int` | `getServerCount()`
    `static void` | `main(String[] args)`
    `void` | `removeListener(Timestamper.UpdateListener lsnr)`
    `void` | `run()`
    `void` | `waitForInitialization()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### PROP_QUERY_FREQUENCY

          public static final String PROP_QUERY_FREQUENCY

      See Also:
        Constant Field Values

    - #### PROP_SERVER_LIST

          public static final String PROP_SERVER_LIST

      See Also:
        Constant Field Values

    - #### PROP_DISABLED

          public static final String PROP_DISABLED

      See Also:
        Constant Field Values

    - #### PROP_CONCURRING_SERVERS

          public static final String PROP_CONCURRING_SERVERS

      See Also:
        Constant Field Values

    - #### PROP_IP_COUNTRY

          public static final String PROP_IP_COUNTRY

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### Timestamper

          public Timestamper(I2PAppContext ctx)

    - #### Timestamper

          public Timestamper(I2PAppContext ctx,
                     Timestamper.UpdateListener lsnr)

    - #### Timestamper

          public Timestamper(I2PAppContext ctx,
                     Timestamper.UpdateListener lsnr,
                     boolean daemon)

  - ### Method Detail

    - #### getServerCount

          public int getServerCount()

    - #### getServer

          public String getServer(int index)

    - #### getQueryFrequencyMs

          public int getQueryFrequencyMs()

    - #### getIsDisabled

          public boolean getIsDisabled()

    - #### addListener

          public void addListener(Timestamper.UpdateListener lsnr)

    - #### removeListener

          public void removeListener(Timestamper.UpdateListener lsnr)

    - #### getListenerCount

          public int getListenerCount()

    - #### getListener

          public Timestamper.UpdateListener getListener(int index)

    - #### waitForInitialization

          public void waitForInitialization()

    - #### run

          public void run()

      Specified by:
        `run` in interface `Runnable`

    - #### main

          public static void main(String[] args)