| 42 | } |
| 43 | |
| 44 | double StopWatch::elapsed() const { |
| 45 | #ifdef WIN32 |
| 46 | LARGE_INTEGER largeInteger; |
| 47 | QueryPerformanceCounter(&largeInteger); |
| 48 | LONGLONG now_count = largeInteger.QuadPart; |
| 49 | double time = (double)( (now_count - start_count_) / static_cast<double>(freq_) ); |
| 50 | #else |
| 51 | timeval now; |
| 52 | gettimeofday(&now, 0); |
| 53 | double time = (now.tv_sec - start_time_.tv_sec) + (now.tv_usec - start_time_.tv_usec) / 1.0e6; |
| 54 | #endif // WIN32 |
| 55 | return truncate_digits(time, 2); |
| 56 | } |
no test coverage detected