Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1420)

Unified Diff: chrome/common/media/webrtc_logging_message_data.cc

Issue 218403004: Fix the timestamp generation for webrtc native log. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/media/webrtc_logging_message_data.h ('k') | chrome/common/media/webrtc_logging_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/media/webrtc_logging_message_data.cc
diff --git a/chrome/common/media/webrtc_logging_message_data.cc b/chrome/common/media/webrtc_logging_message_data.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f1e8395da40f9dd7d450181f3a63e74bce376001
--- /dev/null
+++ b/chrome/common/media/webrtc_logging_message_data.cc
@@ -0,0 +1,25 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/common/media/webrtc_logging_message_data.h"
+
+#include "base/strings/stringprintf.h"
+
+WebRtcLoggingMessageData::WebRtcLoggingMessageData() {}
+
+WebRtcLoggingMessageData::WebRtcLoggingMessageData(base::Time time,
+ const std::string& message)
+ : timestamp(time), message(message) {}
+
+std::string
+WebRtcLoggingMessageData::Format(base::Time start_time) const {
+ int32 interval_ms =
+ static_cast<int32>((timestamp - start_time).InMilliseconds());
+
+ std::string result = base::StringPrintf("[%03d:%03d] %s",
+ interval_ms / 1000,
+ interval_ms % 1000,
+ message.c_str());
+ return result;
+}
« no previous file with comments | « chrome/common/media/webrtc_logging_message_data.h ('k') | chrome/common/media/webrtc_logging_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698