Pārlūkot izejas kodu

fixed SF# 1916761: Bug in Stopwatch?

Guenter Obiltschnig 17 gadi atpakaļ
vecāks
revīzija
e8b0025a5d
1 mainītis faili ar 12 papildinājumiem un 6 dzēšanām
  1. 12 6
      Foundation/include/Poco/Stopwatch.h

+ 12 - 6
Foundation/include/Poco/Stopwatch.h

@@ -1,7 +1,7 @@
 //
 // Stopwatch.h
 //
-// $Id: //poco/svn/Foundation/include/Poco/Stopwatch.h#2 $
+// $Id: //poco/Main/Foundation/include/Poco/Stopwatch.h#3 $
 //
 // Library: Foundation
 // Package: DateTime
@@ -93,16 +93,22 @@ private:
 //
 inline void Stopwatch::start()
 {
-	_start.update();
-	_running = true;
+	if (!_running)
+	{
+		_start.update();
+		_running = true;
+	}
 }
 
 
 inline void Stopwatch::stop()
 {
-	Timestamp current;
-	_elapsed += current - _start;
-	_running = false;
+	if (_running)
+	{
+		Timestamp current;
+		_elapsed += current - _start;
+		_running = false;
+	}
 }