Fix unit reported by TimeTaker (was always ms)

master
Kahrl 2014-10-09 11:15:03 +02:00
parent 8a44df8cba
commit 26495da94a
1 changed files with 11 additions and 2 deletions

View File

@ -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;