diff options
author | imp <imp@FreeBSD.org> | 1999-01-15 05:46:28 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 1999-01-15 05:46:28 +0000 |
commit | b75813237273de59002127268f7de4e1886e25fe (patch) | |
tree | b63a254a2530d0748b82b06011efd2bc5fcb9e15 /usr.sbin/tcpdump | |
parent | 22fad7338cdf09f855b91eeded1448a7634977ff (diff) | |
download | FreeBSD-src-b75813237273de59002127268f7de4e1886e25fe.zip FreeBSD-src-b75813237273de59002127268f7de4e1886e25fe.tar.gz |
Y2K nit:
Make two digit years specified on the command line represent
the century that the computer currently resides. So 99 means
1999 this year, but 2099 next year.
Pointed out by: Peter Jeremy <peter.jeremy@auss2.alcatel.com.au>
Diffstat (limited to 'usr.sbin/tcpdump')
-rw-r--r-- | usr.sbin/tcpdump/tcpslice/tcpslice.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/usr.sbin/tcpdump/tcpslice/tcpslice.c b/usr.sbin/tcpdump/tcpslice/tcpslice.c index 904d9b7..25d245b 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$"; + "$Id: tcpslice.c,v 1.5 1998/01/20 07:30:27 charnier Exp $"; #endif /* not lint */ /* @@ -325,6 +325,9 @@ 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) \ @@ -332,6 +335,10 @@ 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> @@ -358,6 +365,8 @@ fill_tm(char *time_string, int is_delta, struct tm *t, time_t *usecs_addr) case 'y': if ( val > 1900 ) val -= 1900; + else if (val < 100) + val += (tmnow.tm_year / 100) * 100; SET_VAL(t->tm_year, val); break; |