[Lldb-commits] [lldb] r285801 - Remove TimeValue usage from two files

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Wed Nov 2 05:18:43 PDT 2016


Author: labath
Date: Wed Nov  2 07:18:42 2016
New Revision: 285801

URL: http://llvm.org/viewvc/llvm-project?rev=285801&view=rev
Log:
Remove TimeValue usage from two files

Modified:
    lldb/trunk/source/Core/Communication.cpp
    lldb/trunk/source/Core/Log.cpp

Modified: lldb/trunk/source/Core/Communication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Communication.cpp?rev=285801&r1=285800&r2=285801&view=diff
==============================================================================
--- lldb/trunk/source/Core/Communication.cpp (original)
+++ lldb/trunk/source/Core/Communication.cpp Wed Nov  2 07:18:42 2016
@@ -305,8 +305,9 @@ lldb::thread_result_t Communication::Rea
   ConnectionStatus status = eConnectionStatusSuccess;
   bool done = false;
   while (!done && comm->m_read_thread_enabled) {
+    const int timeout_us = 5000000;
     size_t bytes_read = comm->ReadFromConnection(
-        buf, sizeof(buf), 5 * TimeValue::MicroSecPerSec, status, &error);
+        buf, sizeof(buf), timeout_us, status, &error);
     if (bytes_read > 0)
       comm->AppendBytesToCache(buf, bytes_read, true, status);
     else if ((bytes_read == 0) && status == eConnectionStatusEndOfFile) {

Modified: lldb/trunk/source/Core/Log.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Log.cpp?rev=285801&r1=285800&r2=285801&view=diff
==============================================================================
--- lldb/trunk/source/Core/Log.cpp (original)
+++ lldb/trunk/source/Core/Log.cpp Wed Nov  2 07:18:42 2016
@@ -7,20 +7,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-// C Includes
-// C++ Includes
-#include <cstdarg>
-#include <cstdio>
-#include <cstdlib>
-#include <map>
-#include <mutex>
-#include <string>
-
-// Other libraries and framework includes
-#include "llvm/ADT/SmallString.h"
-#include "llvm/Support/Signals.h"
-#include "llvm/Support/raw_ostream.h"
-
 // Project includes
 #include "lldb/Core/Log.h"
 #include "lldb/Core/PluginManager.h"
@@ -28,10 +14,24 @@
 #include "lldb/Core/StreamString.h"
 #include "lldb/Host/Host.h"
 #include "lldb/Host/ThisThread.h"
-#include "lldb/Host/TimeValue.h"
 #include "lldb/Interpreter/Args.h"
 #include "lldb/Utility/NameMatches.h"
 
+// Other libraries and framework includes
+#include "llvm/ADT/SmallString.h"
+#include "llvm/Support/Chrono.h"
+#include "llvm/Support/Signals.h"
+#include "llvm/Support/raw_ostream.h"
+
+// C Includes
+// C++ Includes
+#include <cstdarg>
+#include <cstdio>
+#include <cstdlib>
+#include <map>
+#include <mutex>
+#include <string>
+
 using namespace lldb;
 using namespace lldb_private;
 
@@ -81,8 +81,9 @@ void Log::VAPrintf(const char *format, v
 
     // Timestamp if requested
     if (m_options.Test(LLDB_LOG_OPTION_PREPEND_TIMESTAMP)) {
-      TimeValue now = TimeValue::Now();
-      header.Printf("%9d.%9.9d ", now.seconds(), now.nanoseconds());
+      auto now = std::chrono::duration<double>(
+          std::chrono::system_clock::now().time_since_epoch());
+      header.Printf("%.9f ", now.count());
     }
 
     // Add the process and thread if requested




More information about the lldb-commits mailing list