xref: /original-bsd/lib/libc/gen/times.3 (revision c3e32dec)
1.\" Copyright (c) 1990, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)times.3	8.1 (Berkeley) 06/04/93
7.\"
8.Dd
9.Dt TIMES 3
10.Os BSD 4
11.Sh NAME
12.Nm times
13.Nd process times
14.Sh SYNOPSIS
15.Fd #include <sys/times.h>
16.Ft clock_t
17.Fn times "struct tms *tp"
18.Sh DESCRIPTION
19.Bf -symbolic
20This interface is obsoleted by getrusage(2)
21and gettimeofday(3).
22.Ef
23.Pp
24The
25.Fn times
26function returns the value of time in
27.Dv CLK_TCK Ns 's
28of a second since
290 hours, 0 minutes, 0 seconds, January 1, 1970, Coordinated Universal
30Time.
31.Pp
32It also fills in the structure pointed to by
33.Fa tp
34with time-accounting information.
35.Pp
36The
37.Fa tms
38structure is defined as follows:
39.Bd -literal -offset indent
40typedef struct {
41	clock_t tms_utime;
42	clock_t tms_stime;
43	clock_t tms_cutime;
44	clock_t tms_cstime;
45}
46.Ed
47.Pp
48The elements of this structure are defined as follows:
49.Bl -tag -width tms_cutime
50.It Fa tms_utime
51The
52.Tn CPU
53time charged for the execution of user instructions.
54.It Fa tms_stime
55The
56.Tn CPU
57time charged for execution by the system on behalf of
58the process.
59.It Fa tms_cutime
60The sum of the
61.Fa tms_utime  s
62and
63.Fa tms_cutime  s
64of the child processes.
65.It Fa tms_cstime
66The sum of the
67.Fa tms_stime Ns s
68and
69.Fa tms_cstime Ns s
70of the child processes.
71.El
72.Pp
73All times are in
74.Dv CLK_TCK Ns 's
75of a second.
76.Pp
77The times of a terminated child process are included in the
78.Fa tms_cutime
79and
80.Fa tms_cstime
81elements of the parent when one of the
82.Xr wait 2
83functions returns the process ID of the terminated child to the parent.
84If an error occurs,
85.Fn times
86returns the value
87.Pq (clock_t)\-1 ,
88and sets errno to indicate the error.
89.Sh ERRORS
90The
91.Fn times
92function
93may fail and set the global variable
94.Va errno
95for any of the errors specified for the library
96routines
97.Xr getrusage 2
98and
99.Xr gettimeofday 2 .
100.Sh SEE ALSO
101.Xr time 1 ,
102.Xr getrusage 2 ,
103.Xr gettimeofday 2 ,
104.Xr wait 2
105.Sh STANDARDS
106The
107.Fn times
108function
109conforms to
110.St -p1003.1-88 .
111