xref: /csrg-svn/lib/libc/gen/time.c (revision 42627)
121364Sdist /*
235099Sbostic  * Copyright (c) 1983 Regents of the University of California.
335099Sbostic  * All rights reserved.
435099Sbostic  *
5*42627Sbostic  * %sccs.include.redist.c%
621364Sdist  */
711249Ssam 
826605Sdonn #if defined(LIBC_SCCS) && !defined(lint)
9*42627Sbostic static char sccsid[] = "@(#)time.c	5.6 (Berkeley) 06/01/90";
1035099Sbostic #endif /* LIBC_SCCS and not lint */
1121364Sdist 
1211249Ssam #include <sys/types.h>
1311249Ssam #include <sys/time.h>
1411249Ssam 
1538045Sbostic 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