diff options
Diffstat (limited to 'LibCore/CElapsedTimer.cpp')
-rw-r--r-- | LibCore/CElapsedTimer.cpp | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/LibCore/CElapsedTimer.cpp b/LibCore/CElapsedTimer.cpp index b156147a8b..aec3658fc4 100644 --- a/LibCore/CElapsedTimer.cpp +++ b/LibCore/CElapsedTimer.cpp @@ -1,5 +1,6 @@ #include <LibCore/CElapsedTimer.h> #include <AK/Assertions.h> +#include <AK/Time.h> #include <sys/time.h> void CElapsedTimer::start() @@ -8,22 +9,12 @@ void CElapsedTimer::start() gettimeofday(&m_start_time, nullptr); } -inline void timersub(const struct timeval* a, const struct timeval* b, struct timeval* result) -{ - result->tv_sec = a->tv_sec - b->tv_sec; - result->tv_usec = a->tv_usec - b->tv_usec; - if (result->tv_usec < 0) { - --result->tv_sec; - result->tv_usec += 1000000; - } -} - int CElapsedTimer::elapsed() const { ASSERT(is_valid()); struct timeval now; gettimeofday(&now, nullptr); struct timeval diff; - timersub(&now, &m_start_time, &diff); + AK::timeval_sub(&now, &m_start_time, &diff); return diff.tv_sec * 1000 + diff.tv_usec / 1000; } |