Only use timesstamps from received packets.
keeping track of the sent packets would require a list of paquets we're waiting for. This is overkill.
This commit is contained in:
parent
e85c367e45
commit
1882a84527
1 changed files with 3 additions and 3 deletions
6
echoc.c
6
echoc.c
|
@ -54,8 +54,6 @@ send_packet(bool timestamp)
|
||||||
if (verbose)
|
if (verbose)
|
||||||
warn("sendto");
|
warn("sendto");
|
||||||
}
|
}
|
||||||
if (timestamp)
|
|
||||||
clock_gettime(CLOCK_REALTIME, &sent);
|
|
||||||
if (verbose > 1)
|
if (verbose > 1)
|
||||||
printf("sent %d\n", seq);
|
printf("sent %d\n", seq);
|
||||||
seq++;
|
seq++;
|
||||||
|
@ -169,7 +167,8 @@ main(int argc, char *argv[])
|
||||||
sigaction(SIGALRM, &sa, NULL);
|
sigaction(SIGALRM, &sa, NULL);
|
||||||
|
|
||||||
/* send initial packet */
|
/* send initial packet */
|
||||||
send_packet(true);
|
gettimeofday(&sent, NULL);
|
||||||
|
send_packet(0);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
struct timespec now, diff;
|
struct timespec now, diff;
|
||||||
|
@ -243,6 +242,7 @@ main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
disconnected = 0;
|
disconnected = 0;
|
||||||
last = buffer;
|
last = buffer;
|
||||||
|
gettimeofday(&sent, NULL);
|
||||||
if (verbose > 1)
|
if (verbose > 1)
|
||||||
printf("%d %ld.%06ld\n", buffer, (long)diff.tv_sec,
|
printf("%d %ld.%06ld\n", buffer, (long)diff.tv_sec,
|
||||||
diff.tv_nsec/1000);
|
diff.tv_nsec/1000);
|
||||||
|
|
Loading…
Add table
Reference in a new issue