From e8b205017c5b350f0e85706c6d4b3ea3485d8fbc Mon Sep 17 00:00:00 2001 From: Paul Merrill Date: Wed, 11 Jul 2012 22:46:25 -0700 Subject: [PATCH] fixed? --- src/log.cpp | 15 +++++++-------- src/log.h | 5 ----- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/log.cpp b/src/log.cpp index 3a9b7e1..bd8d0a1 100644 --- a/src/log.cpp +++ b/src/log.cpp @@ -9,6 +9,7 @@ #include "config.h" #include "log.h" #include "python.h" +#include "timer.h" static verbosity_t verb = V_NORMAL; @@ -21,22 +22,20 @@ static std::string& chomp(std::string& str) static std::string ts() { + static Timer timer; + + if (!timer->isRunning()) + timer->setRunning(true); + std::ostringstream ts; ts.precision(4); ts << std::fixed; - ts << Log::tsTimer->count(); + ts << timer->count(); return "[" + ts.str() + "] "; } Log::Log() { - Log::tsTimer = new Timer; - Log::tsTimer->setRunning(true); -} - -Log::~Log() -{ - delete Log::tsTimer; } void Log::setVerbosity(verbosity_t v) diff --git a/src/log.h b/src/log.h index 9eaec78..bcbd11f 100644 --- a/src/log.h +++ b/src/log.h @@ -10,8 +10,6 @@ #include // for boost::noncopyable #include -#include "timer.h" - enum verbosity_t { V_QUIET, // Display fatals. V_NORMAL, // Display fatals and errors. (This is the default.) @@ -27,11 +25,8 @@ public: static void err(std::string domain, std::string msg); static void fatal(std::string domain, std::string msg); - static Timer* tsTimer; - private: Log(); - ~Log(); }; #endif -- 2.11.4.GIT