summaryrefslogtreecommitdiff
path: root/arping.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 /arping.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 'arping.c')
-rw-r--r--arping.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arping.c b/arping.c
index 30884f6..2d05728 100644
--- a/arping.c
+++ b/arping.c
@@ -268,7 +268,7 @@ static int send_pack(struct run_state *ctl)
memcpy(p, &ctl->gdst, 4);
p += 4;
- clock_gettime(CLOCK_MONOTONIC_RAW, &now);
+ clock_gettime(CLOCK_MONOTONIC, &now);
err = sendto(ctl->socketfd, buf, p - buf, 0, (struct sockaddr *)HE, sll_len(ah->ar_hln));
if (err == p - buf) {
ctl->last = now;
@@ -323,7 +323,7 @@ static int recv_pack(struct run_state *ctl, unsigned char *buf, ssize_t len,
unsigned char *p = (unsigned char *)(ah + 1);
struct in_addr src_ip, dst_ip;
- clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
+ clock_gettime(CLOCK_MONOTONIC, &ts);
/* Filter out wild packets */
if (FROM->sll_pkttype != PACKET_HOST &&