121364Sdist /* 235099Sbostic * Copyright (c) 1983 Regents of the University of California. 335099Sbostic * All rights reserved. 435099Sbostic * 535099Sbostic * Redistribution and use in source and binary forms are permitted 635099Sbostic * provided that the above copyright notice and this paragraph are 735099Sbostic * duplicated in all such forms and that any documentation, 835099Sbostic * advertising materials, and other materials related to such 935099Sbostic * distribution and use acknowledge that the software was developed 1035099Sbostic * by the University of California, Berkeley. The name of the 1135099Sbostic * University may not be used to endorse or promote products derived 1235099Sbostic * from this software without specific prior written permission. 1335099Sbostic * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 1435099Sbostic * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 1535099Sbostic * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 1621364Sdist */ 1711249Ssam 1826605Sdonn #if defined(LIBC_SCCS) && !defined(lint) 19*38045Sbostic static char sccsid[] = "@(#)time.c 5.5 (Berkeley) 05/17/89"; 2035099Sbostic #endif /* LIBC_SCCS and not lint */ 2121364Sdist 2211249Ssam #include <sys/types.h> 2311249Ssam #include <sys/time.h> 2411249Ssam 25*38045Sbostic time_t 2611249Ssam time(t) 2711249Ssam time_t *t; 2811249Ssam { 2911249Ssam struct timeval tt; 3011249Ssam 3111305Ssam if (gettimeofday(&tt, (struct timezone *)0) < 0) 32*38045Sbostic return(-1); 3311249Ssam if (t) 3411249Ssam *t = tt.tv_sec; 35*38045Sbostic return(tt.tv_sec); 3611249Ssam } 37