Index: ping.c =================================================================== RCS file: /cvs/src/sbin/ping/ping.c,v retrieving revision 1.114 diff -u -p -r1.114 ping.c --- ping.c 16 Jan 2015 06:40:00 -0000 1.114 +++ ping.c 10 Mar 2015 08:49:34 -0000 @@ -614,10 +614,13 @@ pinger(void) CLR(ntohs(icp->icmp_seq) % mx_dup_ck); if (timing) { + struct timespec ts; struct timeval tv; struct tv32 tv32; - (void)gettimeofday(&tv, (struct timezone *)NULL); + if (clock_gettime(CLOCK_MONOTONIC, &ts) == -1) + err(1, "clock_gettime(CLOCK_MONOTONIC)"); + TIMESPEC_TO_TIMEVAL(&tv, &ts); tv32.tv32_sec = htonl(tv.tv_sec); /* XXX 2038 */ tv32.tv32_usec = htonl(tv.tv_usec); memcpy(&outpack[8], &tv32, sizeof tv32); @@ -670,12 +673,15 @@ pr_pack(char *buf, int cc, struct sockad static int old_rrlen; static char old_rr[MAX_IPOPTLEN]; struct ip *ip, *ip2; + struct timespec ts; struct timeval tv, tp; char *pkttime; quad_t triptime = 0; int hlen, hlen2, dupflag; - (void)gettimeofday(&tv, (struct timezone *)NULL); + if (clock_gettime(CLOCK_MONOTONIC, &ts) == -1) + err(1, "clock_gettime(CLOCK_MONOTONIC)"); + TIMESPEC_TO_TIMEVAL(&tv, &ts); /* Check the IP header */ ip = (struct ip *)buf;