Skip to content

Commit 2ae5310

Browse files
Add timestamp to JSON and XML messages
1 parent 1e7f2bc commit 2ae5310

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/util/ui_message.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,9 @@ void ui_message_handlert::xml_ui_msg(
244244

245245
result.new_element("text").data=msg1;
246246
result.set_attribute("type", type);
247+
const std::string timestamp = time->stamp();
248+
if(!timestamp.empty())
249+
result.set_attribute("timestamp", timestamp);
247250

248251
std::cout << result;
249252
std::cout << '\n';
@@ -263,6 +266,9 @@ void ui_message_handlert::json_ui_msg(
263266

264267
result["messageType"] = json_stringt(type);
265268
result["messageText"] = json_stringt(msg1);
269+
const std::string timestamp = time->stamp();
270+
if(!timestamp.empty())
271+
result["timestamp"] = json_stringt(timestamp);
266272

267273
// By convention a leading comma is created by every new array entry.
268274
// The first entry is generated in the constructor and does not have

0 commit comments

Comments
 (0)