aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorKahrl <kahrl@gmx.net>2014-10-09 11:15:03 +0200
committerKahrl <kahrl@gmx.net>2014-10-09 11:15:03 +0200
commit26495da94a68cf787135fee4915b03f4a91d9e03 (patch)
tree2bbea3be5ea8bd8619c6efd77a31aee9ee0ee441 /src/util
parent8a44df8cba4153e05cd1b81cf392a03d2f7f57d7 (diff)
downloadminetest-26495da94a68cf787135fee4915b03f4a91d9e03.tar.gz
minetest-26495da94a68cf787135fee4915b03f4a91d9e03.tar.bz2
minetest-26495da94a68cf787135fee4915b03f4a91d9e03.zip
Fix unit reported by TimeTaker (was always ms)
Diffstat (limited to 'src/util')
-rw-r--r--src/util/timetaker.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/util/timetaker.cpp b/src/util/timetaker.cpp
index 720a9e1a9..dcf07dc0d 100644
--- a/src/util/timetaker.cpp
+++ b/src/util/timetaker.cpp
@@ -44,8 +44,17 @@ u32 TimeTaker::stop(bool quiet)
}
else
{
- if(quiet == false)
- infostream<<m_name<<" took "<<dtime<<"ms"<<std::endl;
+ if (!quiet) {
+ static const char* const units[] = {
+ "s" /* PRECISION_SECONDS */,
+ "ms" /* PRECISION_MILLI */,
+ "us" /* PRECISION_MICRO */,
+ "ns" /* PRECISION_NANO */,
+ };
+ infostream << m_name << " took "
+ << dtime << units[m_precision]
+ << std::endl;
+ }
}
m_running = false;
return dtime;