diff options
author | peter <peter@FreeBSD.org> | 1997-03-11 11:59:39 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1997-03-11 11:59:39 +0000 |
commit | 5e2372f7211e467141b4939f21d1f81da257c059 (patch) | |
tree | e8158ebc8b78a9fecf4669c3f4f70905fd33f736 /sbin/dump/unctime.c | |
parent | e0e06d68d52707cbac25844a417ab6919613e9eb (diff) | |
download | FreeBSD-src-5e2372f7211e467141b4939f21d1f81da257c059.zip FreeBSD-src-5e2372f7211e467141b4939f21d1f81da257c059.tar.gz |
Import some CSRG 4.4BSD-Lite2 components for sbin onto vendor branch.
(note that some of these have already been imported, this is a no-op)
Diffstat (limited to 'sbin/dump/unctime.c')
-rw-r--r-- | sbin/dump/unctime.c | 57 |
1 files changed, 3 insertions, 54 deletions
diff --git a/sbin/dump/unctime.c b/sbin/dump/unctime.c index 7b3fd4e..bacb469 100644 --- a/sbin/dump/unctime.c +++ b/sbin/dump/unctime.c @@ -32,7 +32,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)unctime.c 8.1 (Berkeley) 6/5/93"; +static char sccsid[] = "@(#)unctime.c 8.2 (Berkeley) 6/14/94"; #endif /* not lint */ #include <sys/types.h> @@ -66,8 +66,6 @@ static char sccsid[] = "@(#)unctime.c 8.1 (Berkeley) 6/5/93"; #define E_SECOND 17 #define E_YEAR 20 -static int dcmp __P((struct tm *, struct tm *)); -static time_t emitl __P((struct tm *)); static int lookup __P((char *)); @@ -88,7 +86,8 @@ unctime(str) then.tm_min = atoi(&dbuf[E_MINUTE]); then.tm_sec = atoi(&dbuf[E_SECOND]); then.tm_year = atoi(&dbuf[E_YEAR]) - 1900; - return(emitl(&then)); + then.tm_isdst = -1; + return(mktime(&then)); } static char months[] = @@ -105,53 +104,3 @@ lookup(str) return((cp-months) / 3); return(-1); } -/* - * Routine to convert a localtime(3) format date back into - * a system format date. - * - * Use a binary search. - */ - -static time_t -emitl(dp) - struct tm *dp; -{ - time_t conv; - register int i, bit; - struct tm dcopy; - - dcopy = *dp; - dp = &dcopy; - conv = 0; - for (i = 30; i >= 0; i--) { - bit = 1 << i; - conv |= bit; - if (dcmp(localtime(&conv), dp) > 0) - conv &= ~bit; - } - return(conv); -} - -/* - * Compare two localtime dates, return result. - */ - -#define DECIDE(a) \ - if (dp->a > dp2->a) \ - return(1); \ - if (dp->a < dp2->a) \ - return(-1) - -static int -dcmp(dp, dp2) - register struct tm *dp, *dp2; -{ - - DECIDE(tm_year); - DECIDE(tm_mon); - DECIDE(tm_mday); - DECIDE(tm_hour); - DECIDE(tm_min); - DECIDE(tm_sec); - return(0); -} |