]> The Tcpdump Group git mirrors - tcpdump/commitdiff
From Gisle Vanem: use ISO 8601 date/time format in "-tttt" mode.
authorguy <guy>
Tue, 4 Mar 2003 08:53:26 +0000 (08:53 +0000)
committerguy <guy>
Tue, 4 Mar 2003 08:53:26 +0000 (08:53 +0000)
util.c

diff --git a/util.c b/util.c
index 81f456d9e93b6b730063b271bd70f0f07e5b9962..c99bcb55c73d1db3470375faeeaeb0a94f5a5e82 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.83 2003-02-08 19:32:00 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/util.c,v 1.84 2003-03-04 08:53:26 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -154,12 +154,14 @@ ts_print(register const struct timeval *tvp)
        case -3: /* Default + Date*/
                s = (tvp->tv_sec + thiszone) % 86400;
                Time = (tvp->tv_sec + thiszone) - s;
-               tm  = gmtime (&Time);
-               (void)printf("%02d/%02d/%04d %02d:%02d:%02d.%06u ",
-                            tm->tm_mon+1, tm->tm_mday,
-                            tm->tm_year+1900,
-                            s / 3600, (s % 3600) / 60,
-                            s % 60, (unsigned)tvp->tv_usec);
+               tm = gmtime (&Time);
+               if (!tm)
+                       printf("Date fail  ");
+               else
+                       printf("%04d-%02d-%02d ",
+                                  tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday);
+               printf("%02d:%02d:%02d.%06u ",
+                          s / 3600, (s % 3600) / 60, s % 60, (unsigned)tvp->tv_usec);
                break;
        }
 }