Exemple #1
0
 public function addTime(Chrono $chrono)
 {
     if ($this->_lastChronoTimestamp === null && $chrono->getStart() !== $this->_startDeclare) {
         return;
     }
     if ($chrono->getTimerManager() === $this) {
         $m = microtime(true);
         if ($this->_lastChronoTimestamp > $chrono->getStart()) {
             $c = $this->_lastChronoTimestamp;
         } else {
             $c = $chrono->getStart();
             $this->_history[] = ['role' => $chrono->getRole(), 'process_in' => $m - $c, 'timer_start' => $c, 'timer_end' => $m];
         }
         $this->_globalTimer += $m - $c;
         $this->_lastTimer = $m - $chrono->getStart();
         $this->_lastChronoTimestamp = $m;
     } else {
         throw new CondorcetException(0, 'Only chrono linked to this Manager can be used');
     }
 }