Esempio n. 1
0
  void Timing::print(std::ostream & out) {
    map_t & tagMap = instance().m_tagMap;
    //list_t & timers = instance().m_timers;
    
    out << "SM Timing\n";
    out << "-----------\n";
    map_t::iterator t = tagMap.begin();
    for( ; t != tagMap.end(); t++) {
      size_t i = t->second;
      out.width((std::streamsize)instance().m_maxTagLength);
      out.setf(std::ios::left,std::ios::adjustfield);
      out << t->first << "\t";
      out.width(7);
      
      out.setf(std::ios::right,std::ios::adjustfield);
      out << getNumSamples(i) << "\t";
      if(getNumSamples(i) > 0) 
	{
	  out << secondsToTimeString(getTotalSeconds(i)) << "\t";
	  double meansec = getMeanSeconds(i);
	  double stddev = sqrt(getVarianceSeconds(i));
	  out << "(" << secondsToTimeString(meansec) << " +- ";
	  out << secondsToTimeString(stddev) << ")\t";
	  
	  double minsec = getMinSeconds(i);
	  double maxsec = getMaxSeconds(i);
	  
	  // The min or max are out of bounds.
	  out << "[" << secondsToTimeString(minsec) << "," << secondsToTimeString(maxsec) << "]";
	  
	}
      out << std::endl;
    }
  }
Esempio n. 2
0
Time Time::operator +(const Time &other) const
{
	int my_total_secs = getTotalSeconds();
	int other_total_secs = other.getTotalSeconds();
	int sum = my_total_secs + other_total_secs;
	return Time(sum);
}
Esempio n. 3
0
void Time::normalize()
{
	int total_secs = getTotalSeconds();
	m_hours = total_secs/3600;
	m_minutes = (total_secs - m_hours*3600)/60;
	m_seconds = total_secs - 60*(m_minutes + 60*m_hours);
}
Esempio n. 4
0
Time Time::operator -(const Time &other) const
{
	int my_total_secs = getTotalSeconds();
	int other_total_secs = other.getTotalSeconds();
	int diff = my_total_secs - other_total_secs;
	if (diff < 0)
		diff = 0;
	return Time(diff);
}
 bool TriggerTimeRange::isActive(QTime startTime, QTime duration, QDateTime now,
         ExecutionState* state)
 {
     int difference = startTime.secsTo(now.time());
     if (difference < 0) {
         // start time is ahead of us today, let's check if previous date hasn't spilled over to cover current time
         if (isValueTrue(
                 getParameter(now.date().addDays(-1).toString("dddd").toStdString(), state))
                 && (difference + 24 * 60 * 60 <= getTotalSeconds(duration))) {
             return true;
         }
     } else {
         // We already passed start time, let's check if duration is long enough to cover current time
         if (isValueTrue(getParameter(now.date().toString("dddd").toStdString(), state))
                 && (difference <= getTotalSeconds(duration))) {
             return true;
         }
     }
     return false;
 }
Esempio n. 6
0
 double Timing::getTotalSeconds(std::string const & tag) {
   return getTotalSeconds(getHandle(tag));
 }