]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Handle negative timestamps in relts_print().
authorfenner <fenner>
Mon, 17 Sep 2001 21:05:43 +0000 (21:05 +0000)
committerfenner <fenner>
Mon, 17 Sep 2001 21:05:43 +0000 (21:05 +0000)
util.c

diff --git a/util.c b/util.c
index fc3a603a3d67fe108ef0a7c82064cee67ea3827b..2b63970237f22e0d1f755567c4b23b2024ccbc7b 100644 (file)
--- a/util.c
+++ b/util.c
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/util.c,v 1.70 2001-09-10 00:28:54 fenner Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/util.c,v 1.71 2001-09-17 21:05:43 fenner Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -183,10 +183,14 @@ relts_print(int secs)
        const char **l = lengths;
        const int *s = seconds;
 
-       if (secs <= 0) {
+       if (secs == 0) {
                (void)printf("0s");
                return;
        }
+       if (secs < 0) {
+               (void)printf("-");
+               secs = -secs;
+       }
        while (secs > 0) {
                if (secs >= *s) {
                        (void)printf("%d%s", secs / *s, *l);