From b66a4094e4f8b8b361aaa22ef19b12b20e9ecff5 Mon Sep 17 00:00:00 2001
From: Julien Malik <julien.malik@c-s.fr>
Date: Wed, 21 Sep 2011 17:28:50 +0200
Subject: [PATCH] ENH: fix precision of elapsedTime in filter watcher

---
 Code/Common/otbStandardOneLineFilterWatcher.cxx | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/Code/Common/otbStandardOneLineFilterWatcher.cxx b/Code/Common/otbStandardOneLineFilterWatcher.cxx
index 272186aa49..392c43e62d 100644
--- a/Code/Common/otbStandardOneLineFilterWatcher.cxx
+++ b/Code/Common/otbStandardOneLineFilterWatcher.cxx
@@ -109,9 +109,16 @@ StandardOneLineFilterWatcher
 ::EndFilter()
 {
   m_TimeProbe.Stop();
+
+  // Ensure we don't depend on std::cout configuration
+  std::ostringstream elapsedTime;
+  elapsedTime.precision(1);
+  elapsedTime << m_TimeProbe.GetMeanTime();
+
   std::cout << " ("
-            << m_TimeProbe.GetMeanTime()
+            << elapsedTime.str()
             << " seconds)"
             << std::endl;
 }
+
 } // end namespace otb
-- 
GitLab