Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.net.ntp
Class TimeInfo

    java.lang.Object
      org.apache.commons.net.ntp.TimeInfo

    public class TimeInfo

extends Object

Wrapper class to network time packet messages (NTP, etc) that computes related timing info and stats.

Version:
  $Revision: 929649 $ $Date: 2010-03-31 19:12:07 +0100 (Wed, 31 Mar 2010) $
Author:
  Jason Mathews, MITRE Corp

Constructor Summary
`TimeInfo(NtpV3Packet message, long returnTime)` Create TimeInfo object with raw packet message and destination time received.
`TimeInfo(NtpV3Packet msgPacket, long returnTime, boolean doComputeDetails)` Create TimeInfo object with raw packet message and destination time received.
`TimeInfo(NtpV3Packet message, long returnTime, List<String> comments)` Create TimeInfo object with raw packet message and destination time received.
`TimeInfo(NtpV3Packet message, long returnTime, List<String> comments, boolean doComputeDetails)` Create TimeInfo object with raw packet message and destination time received.

Method Summary
`void` | `addComment(String comment)` Add comment (error/warning) to list of comments associated with processing of NTP parameters.
`void` | `computeDetails()` Compute and validate details of the NTP message packet.
`List<String>` | `getComments()` Return list of comments (if any) during processing of NTP packet.
`Long` | `getDelay()` Get round-trip network delay.
`NtpV3Packet` | `getMessage()` Returns NTP message packet.
`Long` | `getOffset()` Get clock offset needed to adjust local clock to match remote clock.
`long` | `getReturnTime()` Returns time at which time message packet was received by local machine.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### TimeInfo

    public TimeInfo(NtpV3Packet message,
                    long returnTime)

  Create TimeInfo object with raw packet message and destination time received.

  Parameters:
    `message` - NTP message packet
    `returnTime` - destination receive time
  Throws:
    `IllegalArgumentException` - if message is null

### TimeInfo

    public TimeInfo(NtpV3Packet message,
                    long returnTime,
                    List<String> comments)

  Create TimeInfo object with raw packet message and destination time received.

  Parameters:
    `message` - NTP message packet
    `returnTime` - destination receive time
    `comments` - List of errors/warnings identified during processing
  Throws:
    `IllegalArgumentException` - if message is null

### TimeInfo

    public TimeInfo(NtpV3Packet msgPacket,
                    long returnTime,
                    boolean doComputeDetails)

  Create TimeInfo object with raw packet message and destination time received. Auto-computes details if computeDetails flag set otherwise this is delayed until computeDetails() is called. Delayed computation is for fast intialization when sub-millisecond timing is needed.

  Parameters:
    `msgPacket` - NTP message packet
    `returnTime` - destination receive time
    `doComputeDetails` - flag to pre-compute delay/offset values
  Throws:
    `IllegalArgumentException` - if message is null

### TimeInfo

    public TimeInfo(NtpV3Packet message,
                    long returnTime,
                    List<String> comments,
                    boolean doComputeDetails)

  Create TimeInfo object with raw packet message and destination time received. Auto-computes details if computeDetails flag set otherwise this is delayed until computeDetails() is called. Delayed computation is for fast intialization when sub-millisecond timing is needed.

  Parameters:
    `message` - NTP message packet
    `returnTime` - destination receive time
    `comments` - list of comments used to store errors/warnings with message
    `doComputeDetails` - flag to pre-compute delay/offset values
  Throws:
    `IllegalArgumentException` - if message is null

Method Detail

### addComment

    public void addComment(String comment)

  Add comment (error/warning) to list of comments associated with processing of NTP parameters. If comment list not create then one will be created.

  Parameters:
    `comment` -

### computeDetails

    public void computeDetails()

  Compute and validate details of the NTP message packet. Computed fields include the offset and delay.

### getComments

    public List<String> getComments()

  Return list of comments (if any) during processing of NTP packet.

  Returns:
    List or null if not yet computed

### getDelay

    public Long getDelay()

  Get round-trip network delay. If null then could not compute the delay.

  Returns:
    Long or null if delay not available.

### getOffset

    public Long getOffset()

  Get clock offset needed to adjust local clock to match remote clock. If null then could not compute the offset.

  Returns:
    Long or null if offset not available.

### getMessage

    public NtpV3Packet getMessage()

  Returns NTP message packet.

  Returns:
    NTP message packet.

### getReturnTime

    public long getReturnTime()

  Returns time at which time message packet was received by local machine.

  Returns:
    packet return time.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2011 The Apache Software Foundation. All Rights Reserved.