diff options
author | kwolekr <kwolekr@minetest.net> | 2013-03-29 16:51:57 -0400 |
---|---|---|
committer | kwolekr <kwolekr@minetest.net> | 2013-03-29 16:53:15 -0400 |
commit | df49b93877b40551111be6ef5ecfe4629787ab75 (patch) | |
tree | 003b704c971cdbb36b9bc24f87a1ecf637a5dad8 /src/util/timetaker.cpp | |
parent | 5e7e0347cdae0cab3b7d003fbd3b22c7f820e703 (diff) | |
download | minetest-df49b93877b40551111be6ef5ecfe4629787ab75.tar.gz minetest-df49b93877b40551111be6ef5ecfe4629787ab75.tar.bz2 minetest-df49b93877b40551111be6ef5ecfe4629787ab75.zip |
Add varying levels of precision to TimeTaker
Diffstat (limited to 'src/util/timetaker.cpp')
-rw-r--r-- | src/util/timetaker.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/util/timetaker.cpp b/src/util/timetaker.cpp index 910fea822..720a9e1a9 100644 --- a/src/util/timetaker.cpp +++ b/src/util/timetaker.cpp @@ -23,19 +23,20 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "../log.h" #include <ostream> -TimeTaker::TimeTaker(const char *name, u32 *result) +TimeTaker::TimeTaker(const char *name, u32 *result, TimePrecision prec) { m_name = name; m_result = result; m_running = true; - m_time1 = getTimeMs(); + m_precision = prec; + m_time1 = getTime(prec); } u32 TimeTaker::stop(bool quiet) { if(m_running) { - u32 time2 = getTimeMs(); + u32 time2 = getTime(m_precision); u32 dtime = time2 - m_time1; if(m_result != NULL) { @@ -52,9 +53,9 @@ u32 TimeTaker::stop(bool quiet) return 0; } -u32 TimeTaker::getTime() +u32 TimeTaker::getTimerTime() { - u32 time2 = getTimeMs(); + u32 time2 = getTime(m_precision); u32 dtime = time2 - m_time1; return dtime; } |