}
my $cmd = Test::Command->new(cmd => "fping -4 --icmp-timestamp -c 2 127.0.0.1");
$cmd->exit_is_num(0);
-$cmd->stdout_like(qr{127\.0\.0\.1 : \[0\], 20 bytes, \d\.\d+ ms \(\d\.\d+ avg, 0% loss\)
-ICMP timestamp: Originate=\d+ Receive=\d+ Transmit=\d+
-ICMP timestamp RTT tsrtt=\d+
-127\.0\.0\.1 : \[1\], 20 bytes, \d\.\d+ ms \(\d\.\d+ avg, 0% loss\)
-ICMP timestamp: Originate=\d+ Receive=\d+ Transmit=\d+
-ICMP timestamp RTT tsrtt=\d+
+$cmd->stdout_like(qr{127\.0\.0\.1 : \[0\], 20 bytes, \d\.\d+ ms \(\d\.\d+ avg, 0% loss\), ICMP timestamp: Originate=\d+ Receive=\d+ Transmit=\d+
+127\.0\.0\.1 : \[1\], 20 bytes, \d\.\d+ ms \(\d\.\d+ avg, 0% loss\), ICMP timestamp: Originate=\d+ Receive=\d+ Transmit=\d+
});
$cmd->stderr_like(qr{127\.0\.0\.1 : xmt/rcv/%loss = 2/2/0%, min/avg/max = \d\.\d+/\d\.\d+/\d\.\d+
long ip_header_otime_ms = -1;
long ip_header_rtime_ms = -1;
long ip_header_ttime_ms = -1;
- int tsrtt;
/* Receive packet */
result = receive_packet(wait_time, /* max. wait time, in ns */
fprintf(stderr, " [<- %s]", buf);
}
- printf("\n");
-
if (icmp_request_typ == 13) {
if(ip_header_otime_ms != -1 && ip_header_rtime_ms != -1 && ip_header_ttime_ms != -1) {
- printf("ICMP timestamp: Originate=%lu Receive=%lu Transmit=%lu\n", ip_header_otime_ms, ip_header_rtime_ms, ip_header_ttime_ms);
- tsrtt = (ip_header_ttime_ms - ip_header_otime_ms) + (this_reply - (ip_header_rtime_ms - ip_header_otime_ms));
- printf("ICMP timestamp RTT tsrtt=%d\n", tsrtt);
+ printf(", ICMP timestamp: Originate=%lu Receive=%lu Transmit=%lu", ip_header_otime_ms, ip_header_rtime_ms, ip_header_ttime_ms);
}
else {
- printf("ICMP timestamp: unknown\n");
+ printf(", ICMP timestamp: unknown");
}
}
+
+ printf("\n");
}
return 1;