diff --git a/src/util/timestamper.cpp b/src/util/timestamper.cpp index 8ffb05ea1b3..f063e041cf5 100644 --- a/src/util/timestamper.cpp +++ b/src/util/timestamper.cpp @@ -47,8 +47,7 @@ std::string monotonic_timestampert::stamp() const std::lldiv_t divmod = lldiv(cnt, 1000000); std::stringstream ss; - ss << divmod.quot << "." << std::setfill('0') << std::setw(6) << divmod.rem - << " "; + ss << divmod.quot << "." << std::setfill('0') << std::setw(6) << divmod.rem; return ss.str(); } @@ -67,7 +66,7 @@ std::string wall_clock_timestampert::stamp() const std::stringstream ss; ss << std::put_time(&local, WALL_FORMAT) << std::setfill('0') << std::setw(6) - << u_seconds << " "; + << u_seconds; return ss.str(); } #endif diff --git a/src/util/ui_message.cpp b/src/util/ui_message.cpp index 1ba79f34db4..d725e701315 100644 --- a/src/util/ui_message.cpp +++ b/src/util/ui_message.cpp @@ -110,7 +110,8 @@ void ui_message_handlert::print( { console_message_handlert console_message_handler; std::stringstream ss; - ss << time->stamp() << message; + const std::string timestamp = time->stamp(); + ss << timestamp << (timestamp.empty() ? "" : " ") << message; console_message_handler.print(level, ss.str()); } break; @@ -244,6 +245,9 @@ void ui_message_handlert::xml_ui_msg( result.new_element("text").data=msg1; result.set_attribute("type", type); + const std::string timestamp = time->stamp(); + if(!timestamp.empty()) + result.set_attribute("timestamp", timestamp); std::cout << result; std::cout << '\n'; @@ -263,6 +267,9 @@ void ui_message_handlert::json_ui_msg( result["messageType"] = json_stringt(type); result["messageText"] = json_stringt(msg1); + const std::string timestamp = time->stamp(); + if(!timestamp.empty()) + result["timestamp"] = json_stringt(timestamp); // By convention a leading comma is created by every new array entry. // The first entry is generated in the constructor and does not have