xref: /csrg-svn/lib/libc/gen/time.c (revision 61111)
121364Sdist /*
2*61111Sbostic  * Copyright (c) 1983, 1993
3*61111Sbostic  *	The Regents of the University of California.  All rights reserved.
435099Sbostic  *
542627Sbostic  * %sccs.include.redist.c%
621364Sdist  */
711249Ssam 
826605Sdonn #if defined(LIBC_SCCS) && !defined(lint)
9*61111Sbostic static char sccsid[] = "@(#)time.c	8.1 (Berkeley) 06/04/93";
1035099Sbostic #endif /* LIBC_SCCS and not lint */
1121364Sdist 
1211249Ssam #include <sys/types.h>
1311249Ssam #include <sys/time.h>
1411249Ssam 
1538045Sbostic time_t
time(t)1611249Ssam time(t)
1711249Ssam 	time_t *t;
1811249Ssam {
1911249Ssam 	struct timeval tt;
2011249Ssam 
2111305Ssam 	if (gettimeofday(&tt, (struct timezone *)0) < 0)
2238045Sbostic 		return(-1);
2311249Ssam 	if (t)
2411249Ssam 		*t = tt.tv_sec;
2538045Sbostic 	return(tt.tv_sec);
2611249Ssam }
27