date and time created 91/04/12 13:40:37 by bostic
[unix-history] / usr / src / lib / libc / gen / times.3
CommitLineData
c66d0958
KB
1.\" Copyright (c) 1990 The Regents of the University of California.
2.\" All rights reserved.
43062420 3.\"
c66d0958 4.\" %sccs.include.redist.man%
43062420 5.\"
c66d0958
KB
6.\" @(#)times.3 6.3 (Berkeley) %G%
7.\"
8.TH TIMES 3 ""
43062420
KM
9.UC 4
10.SH NAME
c66d0958 11times \- process times
43062420
KM
12.SH SYNOPSIS
13.nf
c66d0958
KB
14.ft B
15#include <sys/times.h>
16
17clock_t times(struct tms *tp);
18.ft R
43062420
KM
19.fi
20.SH DESCRIPTION
80cc0fcb 21.ft B
c66d0958 22This interface is obsoleted by getrusage(2) and gettimeofday(3).
80cc0fcb
KM
23.ft R
24.PP
c66d0958
KB
25The
26.I times
27function returns the value of time in CLK_TCK's of a second since
280 hours, 0 minutes, 0 seconds, January 1, 1970, Coordinated Universal
29Time.
43062420 30.PP
c66d0958
KB
31It also fills in the structure pointed to by
32.I tp
33with time-accounting information.
43062420 34.PP
c66d0958
KB
35The
36.I tms
37structure is defined as follows:
38.sp
39typedef struct {
40.RS
41clock_t tms_utime;
42.br
43clock_t tms_stime;
44.br
45clock_t tms_cutime;
46.br
47clock_t tms_cstime;
48.br
49.RE
50}
43062420 51.PP
c66d0958
KB
52The elements of this structure are defined as follows:
53.TP
54tms_utime
55The CPU time charged for the execution of user instructions.
56.TP
57tms_stime
58The CPU time charged for execution by the system on behalf of
59the process.
60.TP
61tms_cutime
62The sum of the
63.IR tms_utime s
64and
65.IR tms_cutime s
66of the child processes.
67.TP
68tms_cstime
69The sum of the
70.IR tms_stime s
71and
72.IR tms_cstime s
73of the child processes.
74.PP
75All times are in CLK_TCK's of a second.
76.PP
77The times of a terminated child process are included in the
78.I tms_cutime
79and
80.I tms_cstime
81elements of the parent when one of the
82.IR wait ()
83functions returns the process ID of the terminated child to the parent
84(see
85.IR wait (2)).
86If an error occurs,
87.I times
88returns ((clock_t)-1), and sets errno to indicate the error.
89.SH ERRORS
90.I Times
91may fail and set errno for any of the errors specified for the library
92routines
93.IR getrusage (2)
94and
95.IR gettimeofday (2).
43062420 96.SH "SEE ALSO"
c66d0958
KB
97time(1), getrusage(2), gettimeofday(2), wait(2)
98.SH STANDARDS
99.B Times
100conforms to POSIX Std 1003.1-1988.