Commit | Line | Data |
---|---|---|
bb0cfa24 | 1 | /* |
8add4aa7 KB |
2 | * Copyright (c) 1983 Regents of the University of California. |
3 | * All rights reserved. | |
4 | * | |
269a7923 | 5 | * %sccs.include.redist.c% |
bb0cfa24 DF |
6 | */ |
7 | ||
2ce81398 | 8 | #if defined(LIBC_SCCS) && !defined(lint) |
269a7923 | 9 | static char sccsid[] = "@(#)time.c 5.6 (Berkeley) %G%"; |
8add4aa7 | 10 | #endif /* LIBC_SCCS and not lint */ |
e8e7b5b4 | 11 | |
e8e7b5b4 SL |
12 | #include <sys/types.h> |
13 | #include <sys/time.h> | |
14 | ||
056d9bd8 | 15 | time_t |
e8e7b5b4 SL |
16 | time(t) |
17 | time_t *t; | |
18 | { | |
19 | struct timeval tt; | |
20 | ||
d62fa457 | 21 | if (gettimeofday(&tt, (struct timezone *)0) < 0) |
056d9bd8 | 22 | return(-1); |
e8e7b5b4 SL |
23 | if (t) |
24 | *t = tt.tv_sec; | |
056d9bd8 | 25 | return(tt.tv_sec); |
e8e7b5b4 | 26 | } |