Processor
Time
clock
Syntax
#include
<time.h>
clock-t
clock()
Defined
in
clock.
c in
rts.
src
Description
The clock function determines the amount
of
processor time used. It re-
turns
an
approximation
of
the processor time used by a program since the
program began running. The time in seconds
is
the return value divided
by the value
of
the macro
CLK-
TCK.
If
the processor time
is
not
available or cannot be represented, the clock
function returns the value
of
(clock-t)
-1.
Note:
The clock function is target-system specific, so you must write your
own
clock function. You must also define the
CLK-TCK
macro ac-
cording
to
the granularity
of
your clock, so that the value returned by
clock
()
(number
of
clock ticks) can
be
divided by
CLK-TCK
to pro-
duce a value in seconds.
For more information about the functions and types that the
time.
h
header declares,
see
Section 6.1.10 on page 6-7.
6-29