The clock function

Name

clock -- 

Synopsis

#include <time.h>

clock_t clock ( void);

Description

The clock function determines the processor time used.

Returns

The clock function returns the implementation's best approximation to the processor time used by the program since the beginning of an implementation-defined era related only to the program invocation. To determine the time in seconds, the value returned by the clock function should be divided by the value of the macro CLOCKS_PER_SEC. If the processor time used is not available or its value cannot be represented, then the function returns the value (clock_t)-1.

Implementation Notes

The value of CLOCKS_PER_SEC is 100 by default.
The value of the function clock is zero immediately after the run-time system is started or restarted.
The processor time to wall time ratio is 1:1 while the processor is running.