Use high-resolution timer on Windows This fixes a Windows specific issue where the problem-summary reports timings as zero, as long as the time difference in question is smaller than one second. Change-Id: Ibd91874294423af6acda2575eae80f01aabed6d3
diff --git a/internal/ceres/wall_time.cc b/internal/ceres/wall_time.cc index c353973..09e3c4a 100644 --- a/internal/ceres/wall_time.cc +++ b/internal/ceres/wall_time.cc
@@ -50,7 +50,12 @@ return omp_get_wtime(); #else #ifdef _WIN32 - return static_cast<double>(std::time(NULL)); + LARGE_INTEGER count; + LARGE_INTEGER frequency; + QueryPerformanceCounter(&count); + QueryPerformanceFrequency(&frequency); + return static_cast<double>(count.QuadPart) / + static_cast<double>(frequency.QuadPart); #else timeval time_val; gettimeofday(&time_val, NULL);