__ goes away
[unix-history] / usr / src / lib / libc / gen / times.3
.\" Copyright (c) 1990, 1991 The Regents of the University of California.
.\" All rights reserved.
.\"
.\" %sccs.include.redist.man%
.\"
.\" @(#)times.3 6.4 (Berkeley) %G%
.\"
.Dd
.Dt TIMES 3
.Os BSD 4
.Sh NAME
.Nm times
.Nd process times
.Sh SYNOPSIS
.Fd #include <sys/times.h>
.Ft clock_t
.Fn times "struct tms *tp"
.Sh DESCRIPTION
.Bf -symbolic
This interface is obsoleted by getrusage(2)
and gettimeofday(3).
.Ef
.Pp
The
.Fn times
function returns the value of time in
.Dv CLK_TCK Ns 's
of a second since
0 hours, 0 minutes, 0 seconds, January 1, 1970, Coordinated Universal
Time.
.Pp
It also fills in the structure pointed to by
.Fa tp
with time-accounting information.
.Pp
The
.Fa tms
structure is defined as follows:
.Bd -literal -offset indent
typedef struct {
clock_t tms_utime;
clock_t tms_stime;
clock_t tms_cutime;
clock_t tms_cstime;
}
.Ed
.Pp
The elements of this structure are defined as follows:
.Bl -tag -width tms_cutime
.It Fa tms_utime
The
.Tn CPU
time charged for the execution of user instructions.
.It Fa tms_stime
The
.Tn CPU
time charged for execution by the system on behalf of
the process.
.It Fa tms_cutime
The sum of the
.Fa tms_utime s
and
.Fa tms_cutime s
of the child processes.
.It Fa tms_cstime
The sum of the
.Fa tms_stime Ns s
and
.Fa tms_cstime Ns s
of the child processes.
.El
.Pp
All times are in
.Dv CLK_TCK Ns 's
of a second.
.Pp
The times of a terminated child process are included in the
.Fa tms_cutime
and
.Fa tms_cstime
elements of the parent when one of the
.Xr wait 2
functions returns the process ID of the terminated child to the parent.
If an error occurs,
.Fn times
returns the value
.Pq (clock_t)\-1 ,
and sets errno to indicate the error.
.Sh ERRORS
The
.Fn times
function
may fail and set the global variable
.Va errno
for any of the errors specified for the library
routines
.Xr getrusage 2
and
.Xr gettimeofday 2 .
.Sh SEE ALSO
.Xr time 1 ,
.Xr getrusage 2 ,
.Xr gettimeofday 2 ,
.Xr wait 2
.Sh STANDARDS
The
.Fn times
function
conforms to
.St -p1003.1-88 .