Skip to content

Commit b84bd2b

Browse files
committed
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]"
1 parent 975ea36 commit b84bd2b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

util-print.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,8 @@ ts_date_hmsfrac_print(netdissect_options *ndo, const struct timeval *tv,
249249
char timebuf[32];
250250
const char *timestr;
251251

252-
if ((unsigned)tv->tv_sec & 0x80000000) {
253-
ND_PRINT("[Error converting time]");
252+
if (tv->tv_sec < 0) {
253+
ND_PRINT("[timestamp < 1970-01-01 00:00:00 UTC]");
254254
return;
255255
}
256256

@@ -277,8 +277,8 @@ ts_date_hmsfrac_print(netdissect_options *ndo, const struct timeval *tv,
277277
static void
278278
ts_unix_print(netdissect_options *ndo, const struct timeval *tv)
279279
{
280-
if ((unsigned)tv->tv_sec & 0x80000000) {
281-
ND_PRINT("[Error converting time]");
280+
if (tv->tv_sec < 0) {
281+
ND_PRINT("[timestamp < 1970-01-01 00:00:00 UTC]");
282282
return;
283283
}
284284

0 commit comments

Comments
 (0)