From 456f977ee0de3bfc966c959075f4bef7d2fa6278 Mon Sep 17 00:00:00 2001 From: Jason Downs Date: Mon, 15 Sep 1997 11:29:52 +0000 Subject: Fix NetBSD PR#4068. --- lib/libcompat/4.1/ftime.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'lib/libcompat/4.1') diff --git a/lib/libcompat/4.1/ftime.c b/lib/libcompat/4.1/ftime.c index 45c00e01c7e..deafd7099fb 100644 --- a/lib/libcompat/4.1/ftime.c +++ b/lib/libcompat/4.1/ftime.c @@ -29,12 +29,13 @@ */ #ifndef lint -static char rcsid[] = "$Id: ftime.c,v 1.2 1996/12/14 07:01:27 tholo Exp $"; +static char rcsid[] = "$Id: ftime.c,v 1.3 1997/09/15 11:29:51 downsj Exp $"; #endif /* not lint */ #include #include #include +#include int ftime(tbp) @@ -42,13 +43,24 @@ ftime(tbp) { struct timezone tz; struct timeval t; + struct tm *lt; + time_t now; /* because tv_sec is a long! */ if (gettimeofday(&t, &tz) < 0) return (-1); tbp->millitm = (unsigned short)(t.tv_usec / 1000); tbp->time = t.tv_sec; - tbp->timezone = tz.tz_minuteswest; - tbp->dstflag = tz.tz_dsttime; + + time(&now); + lt = localtime(&now); + if (lt != NULL) { + tbp->timezone = -((lt->tm_isdst ? (lt->tm_gmtoff - 3600) : + lt->tm_gmtoff) / 60); + tbp->dstflag = lt->tm_isdst; + } else { + tbp->timezone = tz.tz_minuteswest; + tbp->dstflag = tz.tz_dsttime; + } return (0); } -- cgit v1.2.3