I am attempting to measure the time it takes for a for loop to iterate 1000 times and the time it takes for a multiplication operation.

I am having some trouble with measuring the ops with enough precision. When I time a for loop interating 1000 times and when I time a multiplication operation, in both instances I get a time of 0. I read that this means that the ops are taking less than one ms. I've been trying to find a method for timing ops with greater precision but so far I have not had any luck. If anyone could point me in the right direction it would be much appreciated.

Code:void matrix::time_for_ops() { loop_timer_start = clock(); // start for loop timer for (int i = 0; i < 1000; i++) { //do nothing } loop_timer_end = clock(); //end for loop timer //===================================== multiplication_timer_start = clock(); //start multi timer test = 3 * 3; multiplication_timer_end = clock(); //end multi timer //====================================== // Output results cout << "Time to execute multiplication = "; cout << (multiplication_timer_end - multiplication_timer_start)/CLOCKS_PER_SEC; cout << endl; cout << "Time for a for loop to execute 1000 times = "; cout << (loop_timer_end - loop_timer_start)/CLOCKS_PER_SEC << endl; return; }