ctime
Returns the number of CPU seconds used.
Synopsis
#include <imsl.h>
double imsl_ctime()
Return Value
The number of CPU seconds used so far by the program.
Example
The CPU time needed to compute
is obtained and printed. The time needed is, of course, machine dependent. The CPU time needed will also vary slightly from run to run on the same machine.
#include <imsl.h>
#include <stdio.h>
int main()
{
int k;
double sum, time;
/* Sum 1 million values */
for (sum=0, k=1; k<=1000000; k++)
sum += k;
/* Get amount of CPU time used */
time = imsl_ctime();
printf("sum = %f\n", sum);
printf("time = %f\n", time);
}
Output
sum = 500000500000.000000
time = 2.260000