Annotated edit history of
clock(3) version 1, including all changes.
View license author blame.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
CLOCK |
|
|
2 |
!!!CLOCK |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
RETURN VALUE |
|
|
7 |
CONFORMING TO |
|
|
8 |
NOTES |
|
|
9 |
SEE ALSO |
|
|
10 |
---- |
|
|
11 |
!!NAME |
|
|
12 |
|
|
|
13 |
|
|
|
14 |
clock - Determine processor time |
|
|
15 |
!!SYNOPSIS |
|
|
16 |
|
|
|
17 |
|
|
|
18 |
__#include |
|
|
19 |
__ |
|
|
20 |
!!DESCRIPTION |
|
|
21 |
|
|
|
22 |
|
|
|
23 |
The __clock()__ function returns an approximation of |
|
|
24 |
processor time used by the program. |
|
|
25 |
!!RETURN VALUE |
|
|
26 |
|
|
|
27 |
|
|
|
28 |
The value returned is the CPU time used so far as a |
|
|
29 |
__clock_t__; to get the number of seconds used, divide by |
|
|
30 |
__CLOCKS_PER_SEC__. If the processor time used is not |
|
|
31 |
available or its value cannot be represented, the function |
|
|
32 |
returns the value (clock_t)-1. |
|
|
33 |
!!CONFORMING TO |
|
|
34 |
|
|
|
35 |
|
|
|
36 |
ANSI C. POSIX requires that CLOCKS_PER_SEC equals 1000000 |
|
|
37 |
independent of the actual resolution. |
|
|
38 |
!!NOTES |
|
|
39 |
|
|
|
40 |
|
|
|
41 |
The C standard allows for arbitrary values at the start of |
|
|
42 |
the program; subtract the value returned from a call to |
|
|
43 |
__clock()__ at the start of the program to get maximum |
|
|
44 |
portability. |
|
|
45 |
|
|
|
46 |
|
|
|
47 |
Note that the time can wrap around. On a 32bit system where |
|
|
48 |
CLOCKS_PER_SEC equals 1000000 this function will return the |
|
|
49 |
same value approximately every 72 minutes. |
|
|
50 |
|
|
|
51 |
|
|
|
52 |
The __times()__ function call returns more |
|
|
53 |
information. |
|
|
54 |
!!SEE ALSO |
|
|
55 |
|
|
|
56 |
|
|
|
57 |
getrusage(2), times(2) |
|
|
58 |
---- |
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.