I've written this code and it does not return the proper time (probably some piece of the code is wrong). And is there any other way to measure time between two actions more precisely then this (in c)?
float measureTime(clock_t start, clock_t end){
float totalSeconds;
totalSeconds = ((long double)(end - start))/CLOCKS_PER_SEC;
printf("%.6f", totalSeconds);
return(totalSeconds);
}
int main(){
clock_t start, end;
start = clock();
//piece of code here
//
end = clock();
measureTime(start, end);
return (EXIT_SUCCESS);
}