1CLOCK(3)                   Linux Programmer's Manual                  CLOCK(3)
2
3
4

NAME

6       clock - Determine processor time
7

SYNOPSIS

9       #include <time.h>
10
11       clock_t clock(void);
12

DESCRIPTION

14       The clock() function returns an approximation of processor time used by
15       the program.
16

RETURN VALUE

18       The value returned is the CPU time used so far as a clock_t; to get the
19       number  of  seconds  used,  divide by CLOCKS_PER_SEC.  If the processor
20       time used is not available or its  value  cannot  be  represented,  the
21       function returns the value (clock_t)-1.
22

CONFORMING TO

24       C89,  C99,  POSIX.1-2001.   POSIX  requires  that CLOCKS_PER_SEC equals
25       1000000 independent of the actual resolution.
26

NOTES

28       The C standard allows for arbitrary values at the start of the program;
29       subtract  the value returned from a call to clock() at the start of the
30       program to get maximum portability.
31
32       Note  that  the  time  can  wrap  around.   On  a  32bit  system  where
33       CLOCKS_PER_SEC  equals 1000000 this function will return the same value
34       approximately every 72 minutes.
35
36       On several other implementations, the value returned  by  clock()  also
37       includes  the times of any children whose status has been collected via
38       wait() (or another wait-type call).  Linux does not include  the  times
39       of  waited-for  children in the value returned by clock().  The times()
40       function, which explicitly returns  (separate)  information  about  the
41       caller and its children, may be preferable.
42

SEE ALSO

44       getrusage(2), times(2)
45
46
47
48GNU                               2002-06-14                          CLOCK(3)
Impressum