Beispiel #1
0
//===========================================================================
void cPrecisionClock::reset()
{
    // initialize clock to zero
    m_timeAccumulated = 0.0;

	// store current CPU time as starting time
    m_timeStart = getCPUTimeSeconds();
}
//===========================================================================
void cPrecisionClock::reset(const double a_currentTime)
{
    // initialize clock
    m_timeAccumulated = a_currentTime;

	// store current CPU time as starting time
    m_timeStart = getCPUTimeSeconds();
}
Beispiel #3
0
//===========================================================================
double cPrecisionClock::getCurrentTimeSeconds()
{
    if (m_on)
    {
        return m_timeAccumulated + getCPUTimeSeconds() - m_timeStart;
    }

    else return m_timeAccumulated;
}
Beispiel #4
0
//===========================================================================
double cPrecisionClock::stop()
{

    // How much time has now elapsed in total running "sessions"?
    m_timeAccumulated += getCPUTimeSeconds() - m_timeStart;

    // stop timer
    m_on = false;

    // return time when timer was stopped
    return getCurrentTimeSeconds();
}
Beispiel #5
0
//===========================================================================
double cPrecisionClock::start(bool a_resetClock)
{
 	// store current CPU time as starting time
    m_timeStart = getCPUTimeSeconds();

    if (a_resetClock)
        m_timeAccumulated = 0.0;

    // timer is now on
    m_on = true;

    // return time when timer was started.
    return m_timeAccumulated;
}