Commits

Jason R. Coombs committed 7871fc0

Added context manager support to timing.Stopwatch

Comments (0)

Files changed (2)

 Changes
 -------
 
+5.4
+~~~
+
+* Added context manager support in `timing.Stopwatch`.
+
 5.3.1
 ~~~~~
 

jaraco/util/timing.py

 	def split(self):
 		local_duration = datetime.datetime.now() - self.start_time
 		return self.elapsed + local_duration
+
+	# context manager support
+	__enter__ = start
+
+	def __exit__(self, exc_type, exc_value, traceback):
+		self.stop()