summaryrefslogtreecommitdiff
path: root/usr.sbin/tcpdump/util.c
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2004-07-28 09:37:27 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2004-07-28 09:37:27 +0000
commit97d5d640adf4808b4fb4275a795624220b92a4e0 (patch)
tree5c58923963225bab14b188fdbd4352969c98b95d /usr.sbin/tcpdump/util.c
parent675615bf2e9a8f1c5af4be98ef468b02f9256355 (diff)
add -ttttt (timestamp difference since the first packet); ok thierry
Diffstat (limited to 'usr.sbin/tcpdump/util.c')
-rw-r--r--usr.sbin/tcpdump/util.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.sbin/tcpdump/util.c b/usr.sbin/tcpdump/util.c
index 46a4cd7d621..b22a3f3e6b1 100644
--- a/usr.sbin/tcpdump/util.c
+++ b/usr.sbin/tcpdump/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.17 2004/06/23 06:12:07 markus Exp $ */
+/* $OpenBSD: util.c,v 1.18 2004/07/28 09:37:26 markus Exp $ */
/*
* Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996, 1997
@@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/util.c,v 1.17 2004/06/23 06:12:07 markus Exp $ (LBL)";
+ "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/util.c,v 1.18 2004/07/28 09:37:26 markus Exp $ (LBL)";
#endif
#include <sys/types.h>
@@ -142,11 +142,13 @@ ts_print(register const struct bpf_timeval *tvp)
printf("%s.%06u ", buf, (u_int32_t)tvp->tv_usec);
break;
case -3:
- /* time since last frame */
+ case -4:
+ /* time since first/last frame */
timersub(tvp, &last, &diff);
(void)printf("%u.%06u ",
(u_int32_t)diff.tv_sec, (u_int32_t)diff.tv_usec);
- last = *tvp;
+ if (tflag == -3 || (last.tv_sec == 0 && last.tv_usec == 0))
+ last = *tvp;
break;
default:
/* Default */