>>20
std::time only has millisecond resolution, nor is it guaranteed to be monotonic. You can't use it for serious timing.
If you're on a POSIX system, use clock_gettime with CLOCK_CLOCK_THREAD_CPUTIME_ID, which has accurate monotonic nanosecond resolution time for the calling thread, and doesn't take into account process/thread context switching.
Awww, too hard for the little baby...
timespec start, end;
double seconds;
clock_gettime(CLOCK_CLOCK_THREAD_CPUTIME_ID, &start);
// do shit
clock_gettime(CLOCK_CLOCK_THREAD_CPUTIME_ID, &end);
seconds = (end.tv_sec - start.tv_sec) + (end.tv_nsec - start.tv_nsec) / 1000000000.0;