1clock(3C)                Standard C Library Functions                clock(3C)
2
3
4

NAME

6       clock - report CPU time used
7

SYNOPSIS

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

DESCRIPTION

15       The  clock()  function returns the amount of CPU time (in microseconds)
16       used since the first call to clock() in the calling process.  The  time
17       reported is the sum of the user and system times of the calling process
18       and its terminated child  processes  for  which  it  has  executed  the
19       wait(3C) function, the pclose(3C) function, or the system(3C) function.
20

RETURN VALUES

22       Dividing  the value returned by clock() by the constant CLOCKS_PER_SEC,
23       defined in the <time.h> header, will give the time in seconds.  If  the
24       process  time  used  is  not available or cannot be  represented, clock
25       returns the value (clock_t) −1.
26

USAGE

28       The value returned by clock() is defined in microseconds  for  compati‐
29       bility  with  systems that have CPU clocks with much higher resolution.
30       Because of this, the value returned will wrap around after accumulating
31       only 2147 seconds of CPU time (about 36 minutes).
32

ATTRIBUTES

34       See attributes(5) for descriptions of the following attributes:
35
36
37
38
39       ┌─────────────────────────────┬─────────────────────────────┐
40       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
41       ├─────────────────────────────┼─────────────────────────────┤
42       │Interface Stability          │Standard                     │
43       ├─────────────────────────────┼─────────────────────────────┤
44       │MT-Level                     │MT-Safe                      │
45       └─────────────────────────────┴─────────────────────────────┘
46

SEE ALSO

48       times(2), popen(3C), system(3C), wait(3C), attributes(5), standards(5)
49
50
51
52SunOS 5.11                        24 Jul 2002                        clock(3C)
Impressum