1 .\" (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date. The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein. The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" Modified Sat Jul 24 21:27:01 1993 by Rik Faith (faith@cs.unc.edu)
24 .\" Modified 14 Jun 2002, Michael Kerrisk <mtk-manpages@gmx.net>
25 .\" Added notes on differences from other Unix systems with respect to
26 .\" waited-for children.
27 .TH CLOCK 3 2002-06-14 "GNU" "Linux Programmer's Manual"
29 clock \- Determine processor time
34 .B clock_t clock(void);
39 function returns an approximation of processor time used by the program.
41 The value returned is the CPU time used so far as a
43 to get the number of seconds used, divide by
45 If the processor time used is not available or its value cannot
46 be represented, the function returns the value (clock_t)\-1.
48 C89, C99, POSIX.1-2001.
49 POSIX requires that CLOCKS_PER_SEC equals 1000000 independent
50 of the actual resolution.
52 The C standard allows for arbitrary values at the start of the program;
53 subtract the value returned from a call to
55 at the start of the program to get maximum portability.
57 Note that the time can wrap around.
58 On a 32bit system where
59 CLOCKS_PER_SEC equals 1000000 this function will return the same
60 value approximately every 72 minutes.
62 On several other implementations,
65 also includes the times of any children whose status has been
68 (or another wait-type call).
69 Linux does not include the times of waited-for children in the
72 .\" I have seen this behavior on Irix 6.3, and the OSF/1, HP/UX, and
73 .\" Solaris manual pages say that clock() also does this on those systems.
74 .\" POSIX.1-2001 doesn't explicitly allow this, nor is there an
75 .\" explicit prohibition. -- MTK
78 function, which explicitly returns (separate) information about the
79 caller and its children, may be preferable.