summaryrefslogtreecommitdiffstats
path: root/usr.sbin/tcpdump/tcpdump
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>1995-09-28 15:28:40 +0000
committerwollman <wollman@FreeBSD.org>1995-09-28 15:28:40 +0000
commite85b8f9435545dc95dfd27a17724b280f2e0ff8c (patch)
tree62a96f428a91fd75220a41b9593a0df55ce1b465 /usr.sbin/tcpdump/tcpdump
parentd55aa6df3bd776f6fb0d019d6351ba5256243665 (diff)
downloadFreeBSD-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/tcpdump')
-rw-r--r--usr.sbin/tcpdump/tcpdump/util.c23
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;
}
OpenPOWER on IntegriCloud