xref: /original-bsd/lib/libc/gen/time.3 (revision b303a108)
1.\" Copyright (c) 1989, 1991 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)time.3	5.3 (Berkeley) 04/19/91
7.\"
8.Dd
9.Dt TIME 3
10.Os BSD 4
11.Sh NAME
12.Nm time
13.Nd get time of day
14.Sh SYNOPSIS
15.Fd #include <sys/types.h>
16.Ft time_t
17.Fn time "time_t *tloc"
18.Sh DESCRIPTION
19The
20.Fn time
21function
22returns the value of time in seconds since 0 hours, 0 minutes,
230 seconds, January 1, 1970, Coordinated Universal Time.
24.Pp
25A copy of the time value may be saved to the area indicated by the
26pointer
27.Fa tloc .
28If
29.Fa tloc
30is a NULL pointer, no value is stored.
31.Pp
32Upon successful completion,
33.Fn time
34returns the value of time.
35Otherwise a value of
36.Po
37.Po Fa time_t Pc \-1
38.Pc
39is returned and the global variable
40.Va errno
41is set to indicate the error.
42.Sh ERRORS
43The following error codes may be set in
44.Va errno :
45.Bl -tag -width [EFAULT]
46.It Bq Er EFAULT
47An argument address referenced invalid memory.
48.Sh SEE ALSO
49.Xr gettimeofday 2 ,
50.Xr ctime 3
51.Sh HISTORY
52A
53.Fn time
54function appeared in
55.At v6 .
56