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