From: Francois-Xavier Le Bail Date: Tue, 19 Mar 2024 19:49:26 +0000 (+0100) Subject: Update the "Error converting time" tests for packet times X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/b84bd2b4b55067d1eea6181e1a09043ac093d48c Update the "Error converting time" tests for packet times Replace 0x80000000 mask test on tv_sec by a test on tv_sec negative in ts_date_hmsfrac_print() and ts_unix_print(). Replace the error message by "[timestamp < 1970-01-01 00:00:00 UTC]" --- diff --git a/util-print.c b/util-print.c index b5dc5aa4..5fc48bef 100644 --- a/util-print.c +++ b/util-print.c @@ -249,8 +249,8 @@ ts_date_hmsfrac_print(netdissect_options *ndo, const struct timeval *tv, char timebuf[32]; const char *timestr; - if ((unsigned)tv->tv_sec & 0x80000000) { - ND_PRINT("[Error converting time]"); + if (tv->tv_sec < 0) { + ND_PRINT("[timestamp < 1970-01-01 00:00:00 UTC]"); return; } @@ -277,8 +277,8 @@ ts_date_hmsfrac_print(netdissect_options *ndo, const struct timeval *tv, static void ts_unix_print(netdissect_options *ndo, const struct timeval *tv) { - if ((unsigned)tv->tv_sec & 0x80000000) { - ND_PRINT("[Error converting time]"); + if (tv->tv_sec < 0) { + ND_PRINT("[timestamp < 1970-01-01 00:00:00 UTC]"); return; }