Using time.h and clock()

Using time.h and clock()

Hello, I'm using this function (clock() from time.h) in my program to get time spended to part of my job.

On local machine I have no problem with it (2x CPU, OS Windows 7, Intel Compiler \\ MSVCC), but when I try to run with it on PBS with qsub, I have bad values of time (f. ex. -0.0, -279.0 ... )

Is using this function not correct on this system?

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Not sure why you're seeing these values, but if you're using OpenMP, I would suggest that you use the OpenMP time function:

double start, end;
start = omp_get_wtime();

... Stuff to time

end = omp_get_wtime();
printf(" Took %f seconds.\n", end-start);

Leave a Comment

Please sign in to add a comment. Not a member? Join today