CARMA C++
|
#include <carma/util/NTPQuery.h>
Public Member Functions | |
double | getDelay () |
Retrieve NTP delay in ms. More... | |
double | getOffset () |
Retrieve NTP offset in ms. More... | |
NTPQuery class.
This class is responsible for carrying out ntp queries. It essentially wraps a good deal of the ntpq c-code found in the ntpq portion of the ntp package.
Definition at line 26 of file NTPQuery.h.
double carma::util::NTPQuery::getDelay | ( | ) |
Retrieve NTP delay in ms.
The delay is the estimated roundtrip network delay between the peer and the current host in milliseconds. It is calculated as follows:
delay = (T4 - T1) - (T3 - T2).
where T1 is the timestamp of a client request message, T2 is the servers timestamp upon arrival, T3 is the server response message timestamp and T4 is the clients timestamp upon receipt of the response. On a typical LAN, this number should be in the sub ten ms range.
double carma::util::NTPQuery::getOffset | ( | ) |
Retrieve NTP offset in ms.
The offset is the NTP estimate of how much the current host's clock differs from a peers. It is calculated as follows:
offset = [(T2 - T1) + (T3 - T4)] / 2
where T1 is the timestamp of a client request message, T2 is the servers timestamp upon arrival, T3 is the server response message timestamp and T4 is the clients timestamp upon receipt of the response. On a typical LAN, this number should be in the sub ms range.