diff --git a/include/wx/log.h b/include/wx/log.h index 5e82ac232d..f3552e9724 100644 --- a/include/wx/log.h +++ b/include/wx/log.h @@ -533,6 +533,7 @@ public: // change it otherwise); the first overload uses the current time. static void TimeStamp(wxString *str); static void TimeStamp(wxString *str, time_t t); + static void TimeStampMS(wxString *str, wxLongLong_t msec); // these methods should only be called from derived classes DoLogRecord(), // DoLogTextAtLevel() and DoLogText() implementations respectively and diff --git a/src/common/log.cpp b/src/common/log.cpp index 8978ca5f77..6f544148c2 100644 --- a/src/common/log.cpp +++ b/src/common/log.cpp @@ -264,10 +264,7 @@ wxLogFormatter::FormatTimeMS(wxLongLong_t msec) const { wxString str; -#if wxUSE_DATETIME - str = wxDateTime(wxLongLong(msec)).Format(wxLog::GetTimestamp()); - str += wxS(": "); -#endif // wxUSE_DATETIME + wxLog::TimeStampMS(&str, msec); return str; } @@ -743,6 +740,15 @@ void wxLog::TimeStamp(wxString *str, time_t t) } } +void wxLog::TimeStampMS(wxString *str, wxLongLong_t msec) +{ + if ( !ms_timestamp.empty() ) + { + *str = wxDateTime(wxLongLong(msec)).Format(wxLog::GetTimestamp()); + *str += wxS(": "); + } +} + #else // !wxUSE_DATETIME void wxLog::TimeStamp(wxString*) @@ -753,6 +759,10 @@ void wxLog::TimeStamp(wxString*, time_t) { } +void wxLog::TimeStampMS(wxString*, wxLongLong_t) +{ +} + #endif // wxUSE_DATETIME/!wxUSE_DATETIME #if wxUSE_THREADS