diff options
author | ShadowNinja <shadowninja@minetest.net> | 2017-06-03 14:55:10 -0400 |
---|---|---|
committer | ShadowNinja <shadowninja@minetest.net> | 2017-06-03 14:55:10 -0400 |
commit | caecdb681c428c1aab9c0f7eec2570c0460f995c (patch) | |
tree | e5115982ea59bbf2343ba9b35bc4a0cfbb56f407 /src/util/timetaker.cpp | |
parent | 81d56b94919dceb7b2e51d70b21a7ca22f852bd5 (diff) | |
parent | 80dc961d24e1964e25d57039ddb2ba639f9f4d22 (diff) | |
download | minetest-caecdb681c428c1aab9c0f7eec2570c0460f995c.tar.gz minetest-caecdb681c428c1aab9c0f7eec2570c0460f995c.tar.bz2 minetest-caecdb681c428c1aab9c0f7eec2570c0460f995c.zip |
Merge 0.4.16 into stable-0.4
Diffstat (limited to 'src/util/timetaker.cpp')
-rw-r--r-- | src/util/timetaker.cpp | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/src/util/timetaker.cpp b/src/util/timetaker.cpp index dcf07dc0d..ac686c3a3 100644 --- a/src/util/timetaker.cpp +++ b/src/util/timetaker.cpp @@ -19,31 +19,26 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "timetaker.h" -#include "../gettime.h" +#include "../porting.h" #include "../log.h" #include <ostream> -TimeTaker::TimeTaker(const char *name, u32 *result, TimePrecision prec) +TimeTaker::TimeTaker(const std::string &name, u64 *result, TimePrecision prec) { m_name = name; m_result = result; m_running = true; m_precision = prec; - m_time1 = getTime(prec); + m_time1 = porting::getTime(prec); } -u32 TimeTaker::stop(bool quiet) +u64 TimeTaker::stop(bool quiet) { - if(m_running) - { - u32 time2 = getTime(m_precision); - u32 dtime = time2 - m_time1; - if(m_result != NULL) - { + if (m_running) { + u64 dtime = porting::getTime(m_precision) - m_time1; + if (m_result != NULL) { (*m_result) += dtime; - } - else - { + } else { if (!quiet) { static const char* const units[] = { "s" /* PRECISION_SECONDS */, @@ -62,10 +57,8 @@ u32 TimeTaker::stop(bool quiet) return 0; } -u32 TimeTaker::getTimerTime() +u64 TimeTaker::getTimerTime() { - u32 time2 = getTime(m_precision); - u32 dtime = time2 - m_time1; - return dtime; + return porting::getTime(m_precision) - m_time1; } |