Class TimeInfo
java.lang.Object
org.apache.commons.net.ntp.TimeInfo
-
Constructor Summary
ConstructorsConstructorDescriptionTimeInfo(NtpV3Packet message, long returnTimeMillis) Create TimeInfo object with raw packet message and destination time received.TimeInfo(NtpV3Packet msgPacket, long returnTimeMillis, boolean doComputeDetails) Create TimeInfo object with raw packet message and destination time received.TimeInfo(NtpV3Packet message, long returnTimeMillis, List<String> comments) Create TimeInfo object with raw packet message and destination time received.TimeInfo(NtpV3Packet message, long returnTimeMillis, List<String> comments, boolean doComputeDetails) Create TimeInfo object with raw packet message and destination time received. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddComment(String comment) Add comment (error/warning) to list of comments associated with processing of NTP parameters.voidCompute and validate details of the NTP message packet.booleanCompares this object against the specified object.Get host address from message datagram if availableReturn list of comments (if any) during processing of NTP packet.getDelay()Get round-trip network delay.Returns NTP message packet.Get clock offset needed to adjust local clock to match remote clock.longReturns time at which time message packet was received by local machine.inthashCode()Computes a hashcode for this object.
-
Constructor Details
-
TimeInfo
Create TimeInfo object with raw packet message and destination time received.- Parameters:
message- NTP message packetreturnTimeMillis- destination receive time- Throws:
IllegalArgumentException- if message is null
-
TimeInfo
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 packetreturnTimeMillis- destination receive timedoComputeDetails- flag to pre-compute delay/offset values- Throws:
IllegalArgumentException- if message is null
-
TimeInfo
Create TimeInfo object with raw packet message and destination time received.- Parameters:
message- NTP message packetreturnTimeMillis- destination receive timecomments- List of errors/warnings identified during processing- Throws:
IllegalArgumentException- if message is null
-
TimeInfo
public TimeInfo(NtpV3Packet message, long returnTimeMillis, 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 packetreturnTimeMillis- destination receive timecomments- list of comments used to store errors/warnings with messagedoComputeDetails- flag to pre-compute delay/offset values- Throws:
IllegalArgumentException- if message is null
-
-
Method Details
-
addComment
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- the comment
-
computeDetails
Compute and validate details of the NTP message packet. Computed fields include the offset and delay. -
equals
Compares this object against the specified object. The result istrueif and only if the argument is notnulland is aTimeStampobject that contains the same values as this object. -
getAddress
Get host address from message datagram if available- Returns:
- host address of available otherwise null
- Since:
- 3.4
-
getComments
Return list of comments (if any) during processing of NTP packet.- Returns:
- List or null if not yet computed
-
getDelay
-
getMessage
-
getOffset
-
getReturnTime
Returns time at which time message packet was received by local machine.- Returns:
- packet return time.
-
hashCode
-