commit 6a12a37a87de3e131e18661cb071b713afa438ec
parent 44175b6e9757902133bd9584ae531c12b91ee17a
Author: Stuart Henderson <sthen@openbsd.org>
Date: Sat, 19 Sep 2020 17:25:11 +1000
Fix timestamp print due to nonstandard bpf_timeval
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/ngrep.c b/ngrep.c
@@ -1128,11 +1128,13 @@ get_filter_from_argv(char **argv)
void
print_time_absolute(const struct pcap_pkthdr *h)
{
- struct tm *t = localtime((const time_t *)&h->ts.tv_sec);
+ struct tm *t;
+ time_t ts = h->ts.tv_sec;
+ t = localtime(&ts);
printf("%02u/%02u/%02u %02u:%02u:%02u.%06u ",
t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour,
- t->tm_min, t->tm_sec, (uint32_t)h->ts.tv_usec);
+ t->tm_min, t->tm_sec, h->ts.tv_usec);
}
void