date and time created 89/05/17 22:49:21 by bostic
[unix-history] / usr / src / lib / libc / gen / time.c
CommitLineData
bb0cfa24 1/*
8add4aa7
KB
2 * Copyright (c) 1983 Regents of the University of California.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms are permitted
6 * provided that the above copyright notice and this paragraph are
7 * duplicated in all such forms and that any documentation,
8 * advertising materials, and other materials related to such
9 * distribution and use acknowledge that the software was developed
10 * by the University of California, Berkeley. The name of the
11 * University may not be used to endorse or promote products derived
12 * from this software without specific prior written permission.
13 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
bb0cfa24
DF
16 */
17
2ce81398 18#if defined(LIBC_SCCS) && !defined(lint)
056d9bd8 19static char sccsid[] = "@(#)time.c 5.5 (Berkeley) %G%";
8add4aa7 20#endif /* LIBC_SCCS and not lint */
e8e7b5b4 21
e8e7b5b4
SL
22#include <sys/types.h>
23#include <sys/time.h>
24
056d9bd8 25time_t
e8e7b5b4
SL
26time(t)
27 time_t *t;
28{
29 struct timeval tt;
30
d62fa457 31 if (gettimeofday(&tt, (struct timezone *)0) < 0)
056d9bd8 32 return(-1);
e8e7b5b4
SL
33 if (t)
34 *t = tt.tv_sec;
056d9bd8 35 return(tt.tv_sec);
e8e7b5b4 36}