diff options
author | wollman <wollman@FreeBSD.org> | 1995-09-28 15:28:40 +0000 |
---|---|---|
committer | wollman <wollman@FreeBSD.org> | 1995-09-28 15:28:40 +0000 |
commit | e85b8f9435545dc95dfd27a17724b280f2e0ff8c (patch) | |
tree | 62a96f428a91fd75220a41b9593a0df55ce1b465 /usr.sbin/tcpdump | |
parent | d55aa6df3bd776f6fb0d019d6351ba5256243665 (diff) | |
download | FreeBSD-src-e85b8f9435545dc95dfd27a17724b280f2e0ff8c.zip FreeBSD-src-e85b8f9435545dc95dfd27a17724b280f2e0ff8c.tar.gz |
Correctly determine the local timezone, by looking at the tm_gmtoff result
from localtime() rather than the bogus struct tz filled in by gettimeofday.
Diffstat (limited to 'usr.sbin/tcpdump')
-rw-r--r-- | usr.sbin/tcpdump/tcpdump/util.c | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/usr.sbin/tcpdump/tcpdump/util.c b/usr.sbin/tcpdump/tcpdump/util.c index 2a44176..b55e6e3 100644 --- a/usr.sbin/tcpdump/tcpdump/util.c +++ b/usr.sbin/tcpdump/tcpdump/util.c @@ -21,7 +21,7 @@ #ifndef lint static char rcsid[] = - "@(#) $Header: util.c,v 1.28 94/06/12 14:30:31 leres Exp $ (LBL)"; + "@(#) $Header: /home/ncvs/src/usr.sbin/tcpdump/tcpdump/util.c,v 1.2 1995/03/08 12:52:49 olah Exp $ (LBL)"; #endif #include <stdlib.h> @@ -317,19 +317,10 @@ read_infile(char *fname) int gmt2local() { -#ifndef SOLARIS - struct timeval now; - struct timezone tz; - long t; - - if (gettimeofday(&now, &tz) < 0) - error("gettimeofday"); - t = tz.tz_minuteswest * -60; - if (localtime((time_t *)&now.tv_sec)->tm_isdst) - t += 3600; - return (t); -#else - tzset(); - return (-altzone); -#endif + time_t now; + struct tm *tmp; + + time(&now); + tmp = localtime(&now); + return tmp->tm_gmtoff; } |