Class PamNTPTime

java.lang.Object
PamUtils.time.ntp.PamNTPTime
All Implemented Interfaces:
PamSettings, SettingsNameProvider, PCTimeCorrector

public class PamNTPTime extends Object implements PCTimeCorrector, PamSettings
Class for measuring the time difference between the PC clock and an NTP server. Largely copied from http://www.avajava.com/tutorials/lessons/how-do-i-query-the-nist-internet-time-service-using-the-network-time-protocol.html
Author:
Doug Gillespie
  • Constructor Details

    • PamNTPTime

      public PamNTPTime(GlobalTimeManager globalTimeManager)
      Private constructor
  • Method Details

    • getUnitName

      public String getUnitName()
      Specified by:
      getUnitName in interface SettingsNameProvider
      Returns:
      A Name specific to this instance of the particular class, e.g. Sperm whale detector, Beaked whale detector, etc.
    • getUnitType

      public String getUnitType()
      Specified by:
      getUnitType in interface PamSettings
      Returns:
      A Name specific to the type, e.g. Click detector
    • getSettingsReference

      public Serializable getSettingsReference()
      Specified by:
      getSettingsReference in interface PamSettings
      Returns:
      The serialisable object that will be stored
    • getSettingsVersion

      public long getSettingsVersion()
      Specified by:
      getSettingsVersion in interface PamSettings
      Returns:
      An integer version number for the settings
    • restoreSettings

      public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings)
      Specified by:
      restoreSettings in interface PamSettings
      Returns:
      true if successful The object performs final checks (if needed) and then casts the settings data pamcontrolledunitSettings.settings into the correct type and uses as required
    • getName

      public String getName()
      Specified by:
      getName in interface PCTimeCorrector
      Returns:
      Name of the time corrector
    • getSource

      public String getSource()
      Specified by:
      getSource in interface PCTimeCorrector
      Returns:
      Name of the source for logging (e.g. NMEA string or NTP server name)
    • showDialog

      public boolean showDialog(Window frame)
      Description copied from interface: PCTimeCorrector
      show a dialog to configure the system
      Specified by:
      showDialog in interface PCTimeCorrector
      Returns:
      OK if dialog was OK'd
    • getUpdateInterval

      public int getUpdateInterval()
      Description copied from interface: PCTimeCorrector
      Likely update interval - can return 0 for very frequency updates (e.g. NMEA data)
      Specified by:
      getUpdateInterval in interface PCTimeCorrector
      Returns:
      update interval in seconds
    • stop

      public void stop()
      Description copied from interface: PCTimeCorrector
      Stop the system
      Specified by:
      stop in interface PCTimeCorrector
    • start

      public boolean start()
      Description copied from interface: PCTimeCorrector
      Start the system
      Specified by:
      start in interface PCTimeCorrector
      Returns:
      true if it seemed to get started OK.
    • getStatus

      public int getStatus()
      Description copied from interface: PCTimeCorrector
      A status flag ?
      Specified by:
      getStatus in interface PCTimeCorrector
      Returns: