121364Sdist /* 2*35099Sbostic * Copyright (c) 1983 Regents of the University of California. 3*35099Sbostic * All rights reserved. 4*35099Sbostic * 5*35099Sbostic * Redistribution and use in source and binary forms are permitted 6*35099Sbostic * provided that the above copyright notice and this paragraph are 7*35099Sbostic * duplicated in all such forms and that any documentation, 8*35099Sbostic * advertising materials, and other materials related to such 9*35099Sbostic * distribution and use acknowledge that the software was developed 10*35099Sbostic * by the University of California, Berkeley. The name of the 11*35099Sbostic * University may not be used to endorse or promote products derived 12*35099Sbostic * from this software without specific prior written permission. 13*35099Sbostic * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 14*35099Sbostic * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 15*35099Sbostic * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 1621364Sdist */ 1711249Ssam 1826605Sdonn #if defined(LIBC_SCCS) && !defined(lint) 19*35099Sbostic static char sccsid[] = "@(#)time.c 5.4 (Berkeley) 07/18/88"; 20*35099Sbostic #endif /* LIBC_SCCS and not lint */ 2121364Sdist 2211249Ssam /* 2311249Ssam * Backwards compatible time call. 2411249Ssam */ 2511249Ssam #include <sys/types.h> 2611249Ssam #include <sys/time.h> 2711249Ssam 2825342Smckusick long 2911249Ssam time(t) 3011249Ssam time_t *t; 3111249Ssam { 3211249Ssam struct timeval tt; 3311249Ssam 3411305Ssam if (gettimeofday(&tt, (struct timezone *)0) < 0) 3511249Ssam return (-1); 3611249Ssam if (t) 3711249Ssam *t = tt.tv_sec; 3811249Ssam return (tt.tv_sec); 3911249Ssam } 40