Esempio n. 1
0
void br::com::sbVB::VBLib::VBClock::printDiffTime() 
{
	checkDiffTime();
	::std::cout.precision(2);
	::std::cout << "Elapsed time (in seconds) is " << getDiffTime() << ::std::endl;
	// myCout << "Elapsed time (in seconds) is " << ::std::endl;
}
////////////////////////////////////////////////////////////////////////////////
//! Stop time measurement and increment add to the current diff_time summation
//! variable. Also increment the number of times this clock has been run.
////////////////////////////////////////////////////////////////////////////////
void
StopWatchLinux::stop() {
    diff_time = getDiffTime();
    total_time += diff_time;
    running = false;
    clock_sessions++;
}
Esempio n. 3
0
 const float getTime() const {
     if(m_running) {
         return getDiffTime();
     } else {
         // time difference in milli-seconds
         return  diff_time;
     }
 }
////////////////////////////////////////////////////////////////////////////////
//! Time in msec. after start. If the stop watch is still running (i.e. there
//! was no call to stop()) then the elapsed time is returned added to the
//! current diff_time sum, otherwise the current summed time difference alone
//! is returned.
////////////////////////////////////////////////////////////////////////////////
float
StopWatchLinux::getTime()
{
    // Return the TOTAL time to date
    float retval = total_time;
    if (running) {
        retval += getDiffTime();
    }

    return retval;
}
Esempio n. 5
0
double copy20mbyte() {
    struct timeval start, finish;
    double runtime;

    gettimeofday(&start, NULL);
    copy(FILE_20_MBYTE, FILE_VOID);
    gettimeofday(&finish, NULL);

    runtime = getDiffTime(start, finish);

    printf("Run time %.10f\n", runtime);

    return runtime;
}
Esempio n. 6
0
void sensor::doMeasure()
{
	int old_value = m_value;

	if(m_inputType == ANALOGTYPE)
	{
		int tempValue = analogRead(m_pin);
		if(m_invertedScale) m_value = map(tempValue, 0, 1024, 100, 0);
		else                m_value = map(tempValue, 0, 1024, 0, 100);
	}
	else if (m_inputType == DIGITALTYPE) m_value = digitalRead(m_pin);
	#ifdef DEBUG
//	Serial.println("sensor::doMeasure()");
	#endif
	if(((abs(old_value - m_value) > 10 && m_inputType == ANALOGTYPE) || m_inputType == DIGITALTYPE) && old_value != m_value || getDiffTime(&m_timer, SENSORSENDPERIOD))
	{
		addToSendBuffer(&m_mqttTopic, &m_value);
	}
}
Esempio n. 7
0
 //! Stop time measurement
 void stop() {
     diff_time = getDiffTime();
     m_running = false;
 }