diff options
-rw-r--r-- | src/util/timetaker.cpp | 13 |
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; |