net.i2p.time
Class Timestamper

java.lang.Object
  extended by net.i2p.time.Timestamper
All Implemented Interfaces:
java.lang.Runnable

public class Timestamper
extends java.lang.Object
implements java.lang.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
static interface Timestamper.UpdateListener
          Interface to receive update notifications for when we query the time Only used by Clock.
 
Field Summary
static java.lang.String PROP_CONCURRING_SERVERS
           
static java.lang.String PROP_DISABLED
           
static java.lang.String PROP_IP_COUNTRY
           
static java.lang.String PROP_QUERY_FREQUENCY
           
static java.lang.String PROP_SERVER_LIST
           
 
Constructor Summary
Timestamper(I2PAppContext ctx)
           
Timestamper(I2PAppContext ctx, Timestamper.UpdateListener lsnr)
           
Timestamper(I2PAppContext ctx, Timestamper.UpdateListener lsnr, boolean daemon)
           
 
Method Summary
 void addListener(Timestamper.UpdateListener lsnr)
           
 boolean getIsDisabled()
           
 Timestamper.UpdateListener getListener(int index)
           
 int getListenerCount()
           
 int getQueryFrequencyMs()
           
 java.lang.String getServer(int index)
           
 int getServerCount()
           
static void main(java.lang.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 java.lang.String PROP_QUERY_FREQUENCY
See Also:
Constant Field Values

PROP_SERVER_LIST

public static final java.lang.String PROP_SERVER_LIST
See Also:
Constant Field Values

PROP_DISABLED

public static final java.lang.String PROP_DISABLED
See Also:
Constant Field Values

PROP_CONCURRING_SERVERS

public static final java.lang.String PROP_CONCURRING_SERVERS
See Also:
Constant Field Values

PROP_IP_COUNTRY

public static final java.lang.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 java.lang.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 java.lang.Runnable

main

public static void main(java.lang.String[] args)