mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-22 16:25:45 +08:00
Change the elapsed time calculation a little.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user