summaryrefslogtreecommitdiffstats
path: root/usr.sbin/tcpdump
diff options
context:
space:
mode:
authorfenner <fenner@FreeBSD.org>1999-01-20 18:33:13 +0000
committerfenner <fenner@FreeBSD.org>1999-01-20 18:33:13 +0000
commit9154d145869e51b2eeb97c7388d8aeb2c623a37f (patch)
treec0b13f49d7e27f223221dfd6972374833e76e124 /usr.sbin/tcpdump
parent34aad2a6dfcf7be8a8496020dcf53592db1c47a0 (diff)
downloadFreeBSD-src-9154d145869e51b2eeb97c7388d8aeb2c623a37f.zip
FreeBSD-src-9154d145869e51b2eeb97c7388d8aeb2c623a37f.tar.gz
Fix raw timestamps (zero-pad usecs)
Print 4-digit years in TIMESTAMP_PARSEABLE mode after '99. PR: bin/9507
Diffstat (limited to 'usr.sbin/tcpdump')
-rw-r--r--usr.sbin/tcpdump/tcpslice/tcpslice.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/tcpdump/tcpslice/tcpslice.c b/usr.sbin/tcpdump/tcpslice/tcpslice.c
index 2c46806..a1ff54e 100644
--- a/usr.sbin/tcpdump/tcpslice/tcpslice.c
+++ b/usr.sbin/tcpdump/tcpslice/tcpslice.c
@@ -27,7 +27,7 @@ static const char copyright[] =
#ifndef lint
static const char rcsid[] =
- "$Id: tcpslice.c,v 1.6 1999/01/15 05:46:28 imp Exp $";
+ "$Id: tcpslice.c,v 1.7 1999/01/15 07:37:00 imp Exp $";
#endif /* not lint */
/*
@@ -567,7 +567,7 @@ timestamp_to_string(struct timeval *timestamp)
switch ( timestamp_style )
{
case TIMESTAMP_RAW:
- sprintf(buf, "%ld.%ld", timestamp->tv_sec, timestamp->tv_usec);
+ sprintf(buf, "%lu.%06lu", timestamp->tv_sec, timestamp->tv_usec);
break;
case TIMESTAMP_READABLE:
@@ -578,6 +578,8 @@ timestamp_to_string(struct timeval *timestamp)
case TIMESTAMP_PARSEABLE:
t = localtime((time_t *) &timestamp->tv_sec);
+ if (t->tm_year >= 100)
+ t->tm_year += 1900;
sprintf( buf, "%02dy%02dm%02dd%02dh%02dm%02ds%06ldu",
t->tm_year, t->tm_mon + 1, t->tm_mday, t->tm_hour,
t->tm_min, t->tm_sec, timestamp->tv_usec );
OpenPOWER on IntegriCloud