Index: remoting/base/util.cc |
diff --git a/remoting/base/util.cc b/remoting/base/util.cc |
index 2e7d7df8d942bf2ac3974176c3e3eb02856b332a..458a745f1b208d1277717a5bd143a293805f43f1 100644 |
--- a/remoting/base/util.cc |
+++ b/remoting/base/util.cc |
@@ -2,16 +2,32 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
+#include "base/logging.h" |
+#include "base/stringprintf.h" |
#include "media/base/video_frame.h" |
#include "media/base/yuv_convert.h" |
#include "remoting/base/util.h" |
-#include "base/logging.h" |
- |
using media::VideoFrame; |
namespace remoting { |
+std::string GetTimestampString() { |
+ // This code is modeled after the timestamp code in LogMessage::Init() (in |
+ // base/logging.cc). |
+ time_t t = time(NULL); |
Sergey Ulanov
2011/08/02 02:21:56
It's better to use base::Time here.
garykac
2011/08/02 18:07:02
Done.
|
+ struct tm local_time = {0}; |
+#if _MSC_VER >= 1400 |
+ localtime_s(&local_time, &t); |
+#else |
+ localtime_r(&t, &local_time); |
+#endif |
+ struct tm* tm_time = &local_time; |
+ return StringPrintf("%02d%02d/%02d%02d%02d:", |
+ 1 + tm_time->tm_mon, tm_time->tm_mday, |
+ tm_time->tm_hour, tm_time->tm_min, tm_time->tm_sec); |
+} |
+ |
int GetBytesPerPixel(VideoFrame::Format format) { |
// Note: The order is important here for performance. This is sorted from the |
// most common to the less common (PIXEL_FORMAT_ASCII is mostly used |