diff options
author | Sami Kerola <kerolasa@iki.fi> | 2018-11-01 20:04:29 +0000 |
---|---|---|
committer | Sami Kerola <kerolasa@iki.fi> | 2018-11-11 10:37:06 +0000 |
commit | 4df68046c86f343494fa285e949270d3a84be54d (patch) | |
tree | 949dcbc9b55f9045d94fb976af8604cbebaf85dd | |
parent | 01cb777d8a3b64dd754297e477f4eb7051392d40 (diff) | |
download | iputils-4df68046c86f343494fa285e949270d3a84be54d.tar.gz |
arping: use monotonic raw clock when measuring reply times
Raw clock is not subject of NTP or adjtime time changes that could distort
measurements.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
-rw-r--r-- | arping.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -352,7 +352,7 @@ static int send_pack(struct run_state *ctl) memcpy(p, &ctl->gdst, 4); p += 4; - clock_gettime(CLOCK_MONOTONIC, &now); + clock_gettime(CLOCK_MONOTONIC_RAW, &now); err = sendto(ctl->socketfd, buf, p - buf, 0, (struct sockaddr *)HE, sll_len(ah->ar_hln)); if (err == p - buf) { ctl->last = now; @@ -407,7 +407,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, &ts); + clock_gettime(CLOCK_MONOTONIC_RAW, &ts); /* Filter out wild packets */ if (FROM->sll_pkttype != PACKET_HOST && @@ -955,7 +955,7 @@ static int event_loop(struct run_state *ctl) perror("arping: timerfd_create failed"); return 1; } - if (clock_gettime(CLOCK_MONOTONIC, &now) == -1) { + if (clock_gettime(CLOCK_MONOTONIC_RAW, &now) == -1) { perror("arping: clock_gettime failed"); return 1; } |