xref: /csrg-svn/lib/libc/gen/time.c (revision 11249)
1*11249Ssam /*	time.c	4.1	83/02/24	*/
2*11249Ssam 
3*11249Ssam /*
4*11249Ssam  * Backwards compatible time call.
5*11249Ssam  */
6*11249Ssam #include <sys/types.h>
7*11249Ssam #include <sys/time.h>
8*11249Ssam 
9*11249Ssam time_t
10*11249Ssam time(t)
11*11249Ssam 	time_t *t;
12*11249Ssam {
13*11249Ssam 	struct timeval tt;
14*11249Ssam 
15*11249Ssam 	if (getimeofday(&tt, (struct timezone *)0) < 0)
16*11249Ssam 		return (-1);
17*11249Ssam 	if (t)
18*11249Ssam 		*t = tt.tv_sec;
19*11249Ssam 	return (tt.tv_sec);
20*11249Ssam }
21