diff options
author | imp <imp@FreeBSD.org> | 1999-01-15 07:37:00 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 1999-01-15 07:37:00 +0000 |
commit | 69a1352a25afd31d1b5a63f514d886cdb2864e28 (patch) | |
tree | 9b9edd03aaed3e890eb9d59cf8a71e49f52dfd74 /usr.sbin/tcpdump | |
parent | c0887878ad4bc034caf441a9373349a58353ef30 (diff) | |
download | FreeBSD-src-69a1352a25afd31d1b5a63f514d886cdb2864e28.zip FreeBSD-src-69a1352a25afd31d1b5a63f514d886cdb2864e28.tar.gz |
Use 69 pivot kludge from date(1) to make it consistant. Also honor
is_delta and only apply date kludge when it isn't a delta time.
Diffstat (limited to 'usr.sbin/tcpdump')
-rw-r--r-- | usr.sbin/tcpdump/tcpslice/tcpslice.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/usr.sbin/tcpdump/tcpslice/tcpslice.c b/usr.sbin/tcpdump/tcpslice/tcpslice.c index 25d245b..2c46806 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.5 1998/01/20 07:30:27 charnier Exp $"; + "$Id: tcpslice.c,v 1.6 1999/01/15 05:46:28 imp Exp $"; #endif /* not lint */ /* @@ -325,9 +325,6 @@ fill_tm(char *time_string, int is_delta, struct tm *t, time_t *usecs_addr) { char *t_start, *t_stop, format_ch; int val; - struct timeval now; - struct timezone tz; - struct tm tmnow; #define SET_VAL(lhs,rhs) \ if (is_delta) \ @@ -335,10 +332,6 @@ fill_tm(char *time_string, int is_delta, struct tm *t, time_t *usecs_addr) else \ lhs = rhs - if (gettimeofday(&now, &tz) < 0) - err(1, "gettimeofday"); - tmnow = *localtime(&now.tv_sec); - /* Loop through the time string parsing one specification at * a time. Each specification has the form <number><letter> * where <number> indicates the amount of time and <letter> @@ -363,10 +356,12 @@ fill_tm(char *time_string, int is_delta, struct tm *t, time_t *usecs_addr) switch (format_ch) { case 'y': - if ( val > 1900 ) + if ( val >= 1900 ) val -= 1900; - else if (val < 100) - val += (tmnow.tm_year / 100) * 100; + else if (val < 100 && !is_delta) { + if (val < 69) /* Same hack as date */ + val += 100; + } SET_VAL(t->tm_year, val); break; |