summaryrefslogtreecommitdiff
path: root/tracepath.c
diff options
context:
space:
mode:
authorSami Kerola <kerolasa@iki.fi>2019-09-08 15:22:36 +0100
committerSami Kerola <kerolasa@iki.fi>2019-09-08 15:35:18 +0100
commitda9a6105b2cab2f92135a282d00cc939760e64c0 (patch)
tree956ac10d59ac058755272c94968727db3b7597b8 /tracepath.c
parent9ada40bac7bab3f3ff4f501d7362cf16c7940451 (diff)
downloadiputils-tracepath-time.tar.gz
arping, tracepath, traceroute6: use clock_gettime(CLOCK_MONOTONIC)tracepath-time
The CLOCK_MONOTONIC_RAW does not get ntp adjustments, that can be considered as a good thing when trying to avoid time jumps.  But downside of RAW time is that it does not get adjtime(3) adjustments resulting to incorrect lenght of a time period.  After all ntp has two functions, it tries to get clock to display correct time and make it run right pace.  The later is what is what is needed when measuring time differences, so CLOCK_MONOTONIC is the indeed better choice. Sure enough an unlucky measurement might to badly wrong when in between start and end of a latency measurement adjtime(3) does an adjustment.  Due to nature of this problem these freak measurements are hard to reproduce, and hopefully rather rare.  If this really turns out to be a problem then the question should be what sort of incorrect time measurement is preferred. Reference: https://github.com/iputils/iputils/pull/213 CC: Petr Vorel <petr.vorel@gmail.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'tracepath.c')
-rw-r--r--tracepath.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tracepath.c b/tracepath.c
index dda50f6..1b5748e 100644
--- a/tracepath.c
+++ b/tracepath.c
@@ -171,7 +171,7 @@ static int recverr(struct run_state *const ctl)
memset(&rcvbuf, -1, sizeof(rcvbuf));
msg = reset;
- clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
+ clock_gettime(CLOCK_MONOTONIC, &ts);
recv_size = recvmsg(ctl->socket_fd, &msg, MSG_ERRQUEUE);
if (recv_size < 0) {
if (errno == EAGAIN)
@@ -376,7 +376,7 @@ static int probe_ttl(struct run_state *const ctl)
htons(ctl->base_port + ctl->hisptr);
break;
}
- clock_gettime(CLOCK_MONOTONIC_RAW, &hdr->ts);
+ clock_gettime(CLOCK_MONOTONIC, &hdr->ts);
ctl->his[ctl->hisptr].hops = ctl->ttl;
ctl->his[ctl->hisptr].sendtime = hdr->ts;
if (sendto(ctl->socket_fd, ctl->pktbuf, ctl->mtu - ctl->overhead, 0,