Merge branch 'master' of github.com:supertuxkart/stk-code

This commit is contained in:
hiker 2017-01-10 13:25:53 +11:00
commit 2641f0b067
2 changed files with 16 additions and 11 deletions

View File

@ -81,3 +81,16 @@ void StkTime::getDate(int *day, int *month, int *year)
if(month) *month = now->tm_mon + 1;
if(year) *year = now->tm_year + 1900;
} // getDate
StkTime::ScopeProfiler::ScopeProfiler(const char* name)
{
Log::info("ScopeProfiler", "%s {\n", name);
m_time = (float)getRealTime();
m_name = name;
}
StkTime::ScopeProfiler::~ScopeProfiler()
{
float f2 = (float)getRealTime();
Log::info("ScopeProfiler", "} // took %f s (%s)\n", (f2 - m_time), m_name.c_str());
}

View File

@ -136,18 +136,10 @@ public:
class ScopeProfiler
{
float m_time;
std::string m_name;
public:
ScopeProfiler(const char* name)
{
printf("%s {\n", name);
m_time = (float)getRealTime();
}
~ScopeProfiler()
{
float f2 = (float)getRealTime();
printf("} // took %f s\n", (f2 - m_time));
}
ScopeProfiler(const char* name);
~ScopeProfiler();
}; // class ScopeProfiler
}; // namespace time