Change the elapsed time calculation a little.

This commit is contained in:
Jonathan Naylor 2016-01-25 18:10:51 +00:00
parent cbc165f22f
commit daa15203e2

View file

@ -72,8 +72,9 @@ unsigned int CStopWatch::elapsed()
struct timeval now;
::gettimeofday(&now, NULL);
unsigned long long a = m_start.tv_sec * 1000ULL + m_start.tv_usec / 1000ULL;
unsigned long long b = now.tv_sec * 1000ULL + now.tv_usec / 1000ULL;
unsigned int elapsed = (now.tv_sec - m_start.tv_sec) * 1000U;
elapsed += now.tv_usec / 1000U;
elapsed -= m_start.tv_usec / 1000U;
return (unsigned int)(b - a);
}