Merge branch 'Bugfix-sigint-time-error' into 'master'

修复 #2 提及的时间结果错误问题,在SIGINT信号处理函数中增加结束时间计算

See merge request common_tools/tcp_burst!4
This commit is contained in:
杨威
2019-08-06 18:53:16 +08:00
2 changed files with 4 additions and 0 deletions

1
.gitignore vendored
View File

@@ -1 +1,2 @@
tcpburst
.vscode

View File

@@ -34,6 +34,7 @@
#include "defines.h"
#include "common.h"
#include <errno.h>
#include <signal.h>
#include <stdlib.h>
@@ -76,6 +77,8 @@ break_now(int signo)
kill(tcpdump.pid, SIGKILL);
#endif
*/
if (gettimeofday(&end, NULL) < 0)
errx(-1, "gettimeofday() failed: %s", strerror(errno));
packet_stats(&begin, &end, bytes_sent, pkts_sent, failed);
exit(1);
}