From d2854834e18443876c8f75e0a7f3b88d1d549fc4 Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Fri, 18 Apr 2014 17:15:39 +0200 Subject: 4.2 --- lib/error_log.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'lib/error_log.cpp') diff --git a/lib/error_log.cpp b/lib/error_log.cpp index fe423479..67584dea 100644 --- a/lib/error_log.cpp +++ b/lib/error_log.cpp @@ -5,7 +5,7 @@ // ************************************************************************** #include "error_log.h" -#include +#include #include #include @@ -16,7 +16,7 @@ void ErrorLogging::logMsg(const wxString& message, zen::MessageType type) { Entry newEntry; newEntry.type = type; - newEntry.time = wxDateTime::GetTimeNow(); + newEntry.time = std::time(NULL); newEntry.message = message; messages.push_back(newEntry); @@ -76,11 +76,11 @@ wxString ErrorLogging::formatMessage(const Entry& msg) break; } - const wxString prefix = wxString(L"[") + wxDateTime(msg.time).FormatTime() + L"] " + typeName + L": "; + const wxString prefix = L"[" + formatTime(FORMAT_TIME, localTime(msg.time)) + L"] " + typeName + L": "; wxString formattedText = prefix; - for (auto i = msg.message.begin(); i != msg.message.end(); ++i) - if (*i == wxChar('\n')) + for (auto iter = msg.message.begin(); iter != msg.message.end(); ) + if (*iter == L'\n') { formattedText += L'\n'; @@ -88,12 +88,14 @@ wxString ErrorLogging::formatMessage(const Entry& msg) blanks.resize(prefix.size(), L' '); formattedText += blanks; - while (*++i == L'\n') //remove duplicate newlines - ; - --i; + do //remove duplicate newlines + { + ++iter; + } + while (iter != msg.message.end() && *iter == L'\n'); } else - formattedText += *i; + formattedText += *iter++; return formattedText; } -- cgit