You can use the clock function from time.h to measure time with extreme precision.
It'll return the number of clocks elapsed since a reference frame (which is implementation defined but it's related to the program's execution).
#include <time.h>
clock_t now = clock();
Now if you want to turn this into an actually understandable time unit, you should divide the result of clock() by CLOCKS_PER_SEC, maybe even multiply it by 1000 to get the result in milliseconds (the precision should be preserved after dividing by CLOCKS_PER_SEC)
double secs = now / CLOCKS_PER_SEC; // Result in seconds
double msecs = secs * 1000; // Result in milliseconds
This will work on all systems.
More information on clock