xref: /csrg-svn/lib/libc/gen/time.c (revision 26605)
121364Sdist /*
221364Sdist  * Copyright (c) 1980 Regents of the University of California.
321364Sdist  * All rights reserved.  The Berkeley software License Agreement
421364Sdist  * specifies the terms and conditions for redistribution.
521364Sdist  */
611249Ssam 
7*26605Sdonn #if defined(LIBC_SCCS) && !defined(lint)
8*26605Sdonn static char sccsid[] = "@(#)time.c	5.3 (Berkeley) 03/09/86";
9*26605Sdonn #endif LIBC_SCCS and not lint
1021364Sdist 
1111249Ssam /*
1211249Ssam  * Backwards compatible time call.
1311249Ssam  */
1411249Ssam #include <sys/types.h>
1511249Ssam #include <sys/time.h>
1611249Ssam 
1725342Smckusick long
1811249Ssam time(t)
1911249Ssam 	time_t *t;
2011249Ssam {
2111249Ssam 	struct timeval tt;
2211249Ssam 
2311305Ssam 	if (gettimeofday(&tt, (struct timezone *)0) < 0)
2411249Ssam 		return (-1);
2511249Ssam 	if (t)
2611249Ssam 		*t = tt.tv_sec;
2711249Ssam 	return (tt.tv_sec);
2811249Ssam }
29