clock
7-28
Processor Time
clock
Syntax
#include <time.h>
clock_t
clock
(void);
Defined in
clock.c in rts.src
Description
The clock function determines the amount of processor time used. It returns
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 CLOCKS_PER_SEC.
If the processor time is not available or cannot be represented, the clock func-
tion returns the value of
−
1.
Note: Writing Your Own Clock Function
The clock function is target-system specific, so you must write your own
clock function. You must also define the CLOCKS_PER_SEC macro accord-
ing to the units of your clock so that the value returned by clock( ) (number
of clock ticks) can be divided by CLOCKS_PER_SEC to produce a value in
seconds.
For more information about the functions and types that the time.h header
declares and defines, see section 7.2.12, Time Function (time.h) on page 7-11.
Cosine
cos
Syntax
#include <math.h>
double
cos
(double x);
Defined in
cos.c in rts.src
Description
The cos function returns the cosine of a floating-point number x. The angle x
is expressed in radians. An argument with a large magnitude might produce
a result with little or no significance.
Example
double radians, cval;
/* cos returns cval */
radians = 3.1415927;
cval = cos(radians);
/* return value = −1.0 */
Summary of Contents for TMS320C2x
Page 8: ...viii...
Page 69: ...2 47 C Compiler Description...
Page 159: ...6 36...
Page 226: ...8 6...