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:
Matthieu Herrb 2012-07-31 08:24:04 +02:00
parent e85c367e45
commit 1882a84527

View file

@ -54,8 +54,6 @@ send_packet(bool timestamp)
if (verbose)
warn("sendto");
}
if (timestamp)
clock_gettime(CLOCK_REALTIME, &sent);
if (verbose > 1)
printf("sent %d\n", seq);
seq++;
@ -169,7 +167,8 @@ main(int argc, char *argv[])
sigaction(SIGALRM, &sa, NULL);
/* send initial packet */
send_packet(true);
gettimeofday(&sent, NULL);
send_packet(0);
while (1) {
struct timespec now, diff;
@ -243,6 +242,7 @@ main(int argc, char *argv[])
}
disconnected = 0;
last = buffer;
gettimeofday(&sent, NULL);
if (verbose > 1)
printf("%d %ld.%06ld\n", buffer, (long)diff.tv_sec,
diff.tv_nsec/1000);