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-Tag: tcpdump-4.99.5~71 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/15b38a333fd93e3e7ab76b39a6a6b391c07c9e99 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]" (cherry picked from commit b84bd2b4b55067d1eea6181e1a09043ac093d48c) --- diff --git a/util-print.c b/util-print.c index 7a6bd099..ec4cf743 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; }