ctime
Returns the number of CPU seconds used.
Synopsis
#include <imsls.h>
double imsls_ctime( )
Return Value
The number of CPU seconds used by the program.
Example
The CPU time needed to compute
is obtained and printed. The time needed is machine dependent. The CPU time needed varies slightly from run to run on the same machine.
 
#include <imsls.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 = imsls_ctime();
printf("sum = %f\n", sum);
printf("time = %f\n", time);
return 0;
}
Output
 
sum = 500000500000.000000
time = 0.820000