浏览代码

Allow to reset a running stop watch (without stopping it!)

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@3063 a333f486-631f-4898-b8df-5754b55c2be0
romainq 11 年之前
父节点
当前提交
2baa5ad44e
共有 1 个文件被更改,包括 8 次插入3 次删除
  1. 8 3
      core/ormstopwatch.class.inc.php

+ 8 - 3
core/ormstopwatch.class.inc.php

@@ -258,16 +258,21 @@ class ormStopWatch
 	public function Reset($oObject, $oAttDef)
 	{
 		$this->iTimeSpent = 0;
-		$this->iStarted = null;
-		$this->iLastStart = null;
 		$this->iStopped = null;
 
 		foreach ($this->aThresholds as $iPercent => &$aThresholdData)
 		{
 			$aThresholdData['triggered'] = false;
-			$aThresholdData['deadline'] = null;
 			$aThresholdData['overrun'] = null;
 		}
+
+		if (!is_null($this->iLastStart))
+		{
+			// Currently running... starting again from now!
+			$this->iStarted = time();
+			$this->iLastStart = time();
+			$this->ComputeDeadlines($oObject, $oAttDef);
+		}
 	}
 
 	/**