Interface NetTimeConfiguration
- All Known Subinterfaces:
SntpConfiguration
Contains the configuration parameters of a connection to an internet time server.
Implementations of this SPI-interface must be
immutable or at least threadsafe. Instances can be
created manually or via a ServiceLoader
.
Note: All implementations must have a public no-arg constructor.
- Since:
- 2.1
- Author:
- Meno Hochschild
- See Also:
NetTimeConnector
,ServiceLoader
-
Field Summary
Modifier and TypeFieldDescriptionstatic int
Default timeout is60
seconds. -
Method Summary
Modifier and TypeMethodDescriptionint
Determines the time window within which an existing shift between the local clock and the internet clock will be synchronized (after a successful connection) if the local clock is too quick.int
Determines the maximum time out when connecting to an internet time server.Yields the internet address of a time server.int
Yields the port of a time server.
-
Field Details
-
DEFAULT_CONNECTION_TIMEOUT
static final int DEFAULT_CONNECTION_TIMEOUTDefault timeout is
60
seconds.- See Also:
- Constant Field Values
-
-
Method Details
-
getTimeServerAddress
String getTimeServerAddress()Yields the internet address of a time server.
Possible values are also addresses of older time servers which still support the elder protocol (RFC 867), for example:
- time.nist.gov (US-government)
- time.ien.it (electrotechn. institute in Italy)
Alternatively, addresses of modern NTP-servers are permitted which support the protocols NTP3 or NTP4:
- ptbtime1.ptb.de
- ptbtime2.ptb.de
- ntp2.lrz-muenchen.de
- Returns:
- time server address
- Since:
- 2.1
-
getTimeServerPort
int getTimeServerPort()Yields the port of a time server.
The DAYTIME-protocol assumes as default value
13
while NTP-protocols usually use the value123
.- Returns:
- int
- Since:
- 2.1
-
getConnectionTimeout
int getConnectionTimeout()Determines the maximum time out when connecting to an internet time server.
The value
0
indicates an unlimited waiting time. The default value is internally60
seconds.- Returns:
- maximum waiting time in seconds
>= 0
- Since:
- 2.1
- See Also:
DEFAULT_CONNECTION_TIMEOUT
-
getClockShiftWindow
int getClockShiftWindow()Determines the time window within which an existing shift between the local clock and the internet clock will be synchronized (after a successful connection) if the local clock is too quick.
The value
0
causes the immediate synchronization and is the default. Else the local clock will only be synchronized with the internet clock after this clock shift window has been passed. Within this time window the local clock will be slowly adjusted to the internet clock. The time window should always be choosen such that it is smaller than the time between two connections. Its main purpose is slowing down a local clock such that applications will not notice any backwards running time within the scope of expected precision.If the local clock is too slow however then the synchronization will happen immediately, and this configuration parameter is not applied.
- Returns:
- time window in seconds (
>= 0
) - Since:
- 2.1
-