Remove custom TimePoint-formatting code
authorPavel Labath <labath@google.com>
Mon, 27 Nov 2017 17:06:42 +0000 (17:06 +0000)
committerPavel Labath <labath@google.com>
Mon, 27 Nov 2017 17:06:42 +0000 (17:06 +0000)
This was a temporary thing, until llvm has proper support for formatting
time. That time has come, so we can remove the relevant code. There
should be no change in the format of the time.

llvm-svn: 319048

lldb/source/Commands/CommandObjectTarget.cpp

index 583ab2a..c83061d 100644 (file)
@@ -52,6 +52,7 @@
 #include "lldb/Utility/Timer.h"
 
 #include "llvm/Support/FileSystem.h"
+#include "llvm/Support/FormatAdapters.h"
 
 // C Includes
 // C++ Includes
@@ -135,25 +136,6 @@ static uint32_t DumpTargetList(TargetList &target_list,
   return num_targets;
 }
 
-// TODO: Remove this once llvm can pretty-print time points
-static void DumpTimePoint(llvm::sys::TimePoint<> tp, Stream &s, uint32_t width) {
-#ifndef LLDB_DISABLE_POSIX
-  char time_buf[32];
-  time_t time = llvm::sys::toTimeT(tp);
-  char *time_cstr = ::ctime_r(&time, time_buf);
-  if (time_cstr) {
-    char *newline = ::strpbrk(time_cstr, "\n\r");
-    if (newline)
-      *newline = '\0';
-    if (width > 0)
-      s.Printf("%-*s", width, time_cstr);
-    else
-      s.PutCString(time_cstr);
-  } else if (width > 0)
-    s.Printf("%-*s", width, "");
-#endif
-}
-
 #pragma mark CommandObjectTargetCreate
 
 //-------------------------------------------------------------------------
@@ -3176,7 +3158,8 @@ protected:
       } break;
 
       case 'm':
-        DumpTimePoint(module->GetModificationTime(), strm, width);
+        strm.Format("{0:%c}", llvm::fmt_align(module->GetModificationTime(),
+                                              llvm::AlignStyle::Left, width));
         break;
 
       case 'p':