From e85b8f9435545dc95dfd27a17724b280f2e0ff8c Mon Sep 17 00:00:00 2001 From: wollman Date: Thu, 28 Sep 1995 15:28:40 +0000 Subject: Correctly determine the local timezone, by looking at the tm_gmtoff result from localtime() rather than the bogus struct tz filled in by gettimeofday. --- usr.sbin/tcpdump/tcpdump/util.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) (limited to 'usr.sbin/tcpdump') 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 @@ -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; } -- cgit v1.1