xref: /csrg-svn/lib/libc/gen/time.c (revision 25342)
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 
721364Sdist #ifndef lint
8*25342Smckusick static char sccsid[] = "@(#)time.c	5.2 (Berkeley) 10/30/85";
921364Sdist #endif not lint
1021364Sdist 
1111249Ssam /*
1211249Ssam  * Backwards compatible time call.
1311249Ssam  */
1411249Ssam #include <sys/types.h>
1511249Ssam #include <sys/time.h>
1611249Ssam 
17*25342Smckusick 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