'\"macro stdmacro
.if n .pH g2.times @(#)times	40.15 of 10/10/89
.\" Copyright 1989 AT&T
.nr X
.if \nX=0 .ds x} times 2 "" "\&"
.if \nX=1 .ds x} times 2 ""
.if \nX=2 .ds x} times 2 "" "\&"
.if \nX=3 .ds x} times "" "" "\&"
.TH \*(x}
.SH NAME
\f4times\f1 \- get process and child process times
.SH SYNOPSIS
\f4#include <sys/types.h>\f1
.br
\f4#include <sys/times.h>\f1
.PP
\f4clock_t times(struct tms \(**buffer);\f1
.SH DESCRIPTION
\f4times\fP
fills the \f4tms\fP structure pointed to by
.I buffer\^
with time-accounting information.
The \f4tms\fP structure is defined in \f4<sys/times.h>\fP as follows:
.PP
.RS
.nf
.ft 4
.ta .5i 1i 1.75i
struct	tms {
	clock_t    tms_utime;
	clock_t    tms_stime;
	clock_t    tms_cutime;
	clock_t    tms_cstime;
};
.ft 1
.fi
.RE
.PP
This information comes from the calling process
and each of its terminated child processes for which it has executed a
wait routine.
All times are reported in clock ticks per second.
Clock ticks are a system-dependent parameter.
The specific value for an implementation 
is defined by the variable \f4CLK_TCK\fP,
found in the include file \f4limits.h\fP.
(On a 3B2 Computer
clock ticks occur 100 times per second.)
.PP
\f4tms_utime\fP
is the
.SM CPU
time used while executing instructions in the user space of the
calling process.
.PP
\f4tms_stime\fP
is the
.SM CPU
time used by the system on behalf of the calling process.
.PP
\f4tms_cutime\fP
is the sum of the
\f4tms_utime\fP
and the
\f4tms_cutime\fP
of the child processes.
.PP
\f4tms_cstime\fP
is the sum of the
\f4tms_stime\fP
and the
\f4tms_cstime\fP
of the child processes.
.PP
\f4times\fP fails if:
.TP 14
\f4EFAULT\fP
.I buffer\^
points to an illegal address.
.SH "SEE ALSO"
\f4exec\fP(2), \f4fork\fP(2), \f4time\fP(2), \f4wait\fP(2), \f4waitid\fP(2),
\f4waitpid\fP(3C).
.br
\f4time\fP(1), \f4timex\fP(1) in the \f2User's Reference Manual\f1.
.SH DIAGNOSTICS
Upon successful completion,
\f4times\fP
returns the elapsed real time, in
clock ticks per second,
from an arbitrary point in the past
(e.g., system start-up time).
This point does not change from one invocation of
\f4times\fP
to another.
If
\f4times\fP
fails, a \-1 is returned and
\f4errno\fP
is set to indicate the error.
.\"	@(#)times.2	6.2 of 9/6/83
.Ee
