Class DaytimeClock

All Implemented Interfaces:
TimeSource<Moment>

public class DaytimeClock extends NetTimeConnector<NetTimeConfiguration>

Represents a connection to a DAYTIME-server following the old norm RFC 867.

Note that the format of the server reply is not specified by the protocol. Furthermore, many internet time servers have stopped to support this old protocol. Actually in year 2014, at least the addresses "time.nist.gov" and "time.ien.it" are still working. Applications cannot expect more than second precision at best.

Note: This implementation is threadsafe.

Since:
2.1
Author:
Meno Hochschild
  • Field Details

    • NIST

      public static final DaytimeClock NIST

      Defines an instance which supports the NIST-servers using the multiple-location-address "time.nist.gov" and a specific format.

      The format is documented at www.nist.gov.

  • Constructor Details

    • DaytimeClock

      public DaytimeClock(String server, ChronoParser<Moment> parser)

      Creates a new instance which uses the given time server on the port 13.

      Parameters:
      server - time server address (example: "time.nist.gov")
      parser - object interpreting the server reply
  • Method Details

    • getRawTimestamp

      public String getRawTimestamp() throws IOException

      Tries to get the raw server timestamp as original string.

      Returns:
      unparsed server reply
      Throws:
      IOException - if connection fails
      Since:
      2.1