Prefix private members with "m_".

This commit is contained in:
Tetsuo Kiso 2012-02-26 13:52:47 +09:00
parent ff5ae511b1
commit c62365b419
2 changed files with 10 additions and 10 deletions

View File

@ -5,7 +5,7 @@ double Timer::elapsed_time()
{
time_t now;
time(&now);
return difftime(now, start_time);
return difftime(now, m_start_time);
}
double Timer::get_elapsed_time()
@ -19,13 +19,13 @@ void Timer::start(const char* msg)
if (msg) TRACE_ERR( msg << std::endl);
// Return immediately if the timer is already running
if (running) return;
if (m_is_running) return;
// Change timer status to running
running = true;
m_is_running = true;
// Set the start time;
time(&start_time);
time(&m_start_time);
}
/***
@ -69,5 +69,5 @@ void Timer::check(const char* msg)
if (msg) TRACE_ERR( msg << " : ");
// TRACE_ERR( "[" << std::setiosflags(std::ios::fixed) << std::setprecision(2) << (running ? elapsed_time() : 0) << "] seconds\n");
TRACE_ERR( "[" << (running ? elapsed_time() : 0) << "] seconds\n");
TRACE_ERR( "[" << (m_is_running ? elapsed_time() : 0) << "] seconds\n");
}

View File

@ -15,8 +15,8 @@ class Timer
friend std::ostream& operator<<(std::ostream& os, Timer& t);
private:
bool running;
time_t start_time;
bool m_is_running;
time_t m_start_time;
/**
* Return the total time that the timer has been in the "running"
@ -29,10 +29,10 @@ private:
public:
/**
* 'running' is initially false. A timer needs to be explicitly started
* 'm_is_running' is initially false. A timer needs to be explicitly started
* using 'start' or 'restart'.
*/
Timer() : running(false), start_time(0) { }
Timer() : m_is_running(false), m_start_time(0) { }
/**
* Start a timer. If it is already running, let it continue running.
@ -60,7 +60,7 @@ public:
inline std::ostream& operator<<(std::ostream& os, Timer& t)
{
//os << std::setprecision(2) << std::setiosflags(std::ios::fixed) << (t.running ? t.elapsed_time() : 0);
os << (t.running ? t.elapsed_time() : 0);
os << (t.m_is_running ? t.elapsed_time() : 0);
return os;
}