make shadow records really work
[unix-history] / usr / src / lib / libc / gen / times.3
CommitLineData
ae59e04c 1.\" Copyright (c) 1990, 1991 The Regents of the University of California.
c66d0958 2.\" All rights reserved.
43062420 3.\"
c66d0958 4.\" %sccs.include.redist.man%
43062420 5.\"
ae59e04c 6.\" @(#)times.3 6.4 (Berkeley) %G%
c66d0958 7.\"
ae59e04c
CL
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
c66d0958 24The
ae59e04c
CL
25.Fn times
26function returns the value of time in
27.Dv CLK_TCK Ns 's
28of a second since
c66d0958
KB
290 hours, 0 minutes, 0 seconds, January 1, 1970, Coordinated Universal
30Time.
ae59e04c 31.Pp
c66d0958 32It also fills in the structure pointed to by
ae59e04c 33.Fa tp
c66d0958 34with time-accounting information.
ae59e04c 35.Pp
c66d0958 36The
ae59e04c 37.Fa tms
c66d0958 38structure is defined as follows:
ae59e04c 39.Bd -literal -offset indent
c66d0958 40typedef struct {
ae59e04c
CL
41 clock_t tms_utime;
42 clock_t tms_stime;
43 clock_t tms_cutime;
44 clock_t tms_cstime;
c66d0958 45}
ae59e04c
CL
46.Ed
47.Pp
c66d0958 48The elements of this structure are defined as follows:
ae59e04c
CL
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
c66d0958 58the process.
ae59e04c 59.It Fa tms_cutime
c66d0958 60The sum of the
ae59e04c 61.Fa tms_utime s
c66d0958 62and
ae59e04c 63.Fa tms_cutime s
c66d0958 64of the child processes.
ae59e04c 65.It Fa tms_cstime
c66d0958 66The sum of the
ae59e04c 67.Fa tms_stime Ns s
c66d0958 68and
ae59e04c 69.Fa tms_cstime Ns s
c66d0958 70of the child processes.
ae59e04c
CL
71.El
72.Pp
73All times are in
74.Dv CLK_TCK Ns 's
75of a second.
76.Pp
c66d0958 77The times of a terminated child process are included in the
ae59e04c 78.Fa tms_cutime
c66d0958 79and
ae59e04c 80.Fa tms_cstime
c66d0958 81elements of the parent when one of the
ae59e04c
CL
82.Xr wait 2
83functions returns the process ID of the terminated child to the parent.
c66d0958 84If an error occurs,
ae59e04c
CL
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
c66d0958 96routines
ae59e04c 97.Xr getrusage 2
c66d0958 98and
ae59e04c
CL
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 .