macro and text revision (-mdoc version 3)
[unix-history] / usr / src / lib / libc / gen / times.3
index 807db97..1f37425 100644 (file)
-.\" Copyright (c) 1980 Regents of the University of California.
-.\" All rights reserved.  The Berkeley software License Agreement
-.\" specifies the terms and conditions for redistribution.
+.\" Copyright (c) 1990, 1991 The Regents of the University of California.
+.\" All rights reserved.
 .\"
 .\"
-.\"    @(#)times.3     6.2 (Berkeley) %G%
+.\" %sccs.include.redist.man%
 .\"
 .\"
-.TH TIMES 3C ""
-.UC 4
-.SH NAME
-times \- get process times
-.SH SYNOPSIS
-.nf
-.B "#include <sys/types.h>
-.B "#include <sys/times.h>
-.PP
-.B times(buffer)
-.B struct tms *buffer;
-.fi
-.SH DESCRIPTION
-.ft B
-This interface is obsoleted by getrusage(2).
-.br
-It is available from the compatibility library, libcompat.
-.ft R
-.PP
-.I Times
-returns time-accounting information
-for the current process
-and for the terminated child processes
-of the current process.
-All times are in 1/HZ seconds, where HZ is 60.
-.PP
-This is the structure returned by
-.IR times :
-.PP
-.nf
-.so /usr/include/sys/times.h
-.PP
-.fi
-The children times are the sum
-of the children's process times and
-their children's times.
-.SH "SEE ALSO"
-time(1), getrusage(2), wait3(2), time(3)
+.\"     @(#)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 .