Implement the toString method
authorReid Spencer <rspencer@reidspencer.com>
Sun, 14 Nov 2004 22:10:08 +0000 (22:10 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Sun, 14 Nov 2004 22:10:08 +0000 (22:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17782 91177308-0d34-0410-b5e6-96231b3b80d8

lib/System/Unix/TimeValue.cpp
lib/System/Unix/TimeValue.inc

index 1fbedcab4fe7f27f343b1756bcced5632007ef82..f029f8dadca024d5a5dea520cd8c6cbb2f0f8f3f 100644 (file)
 
 #include "Unix.h"
 
+#include <time.h>
+
+namespace llvm {
+  using namespace sys;
+
+
+std::string TimeValue::toString() {
+  char buffer[32];
+
+  time_t ourTime = time_t(this->toEpochTime());
+  ::asctime_r(::localtime(&ourTime), buffer);
+
+  std::string result(buffer);
+  return result.substr(0,24);
+}
+
 }
 // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab
index 1fbedcab4fe7f27f343b1756bcced5632007ef82..f029f8dadca024d5a5dea520cd8c6cbb2f0f8f3f 100644 (file)
 
 #include "Unix.h"
 
+#include <time.h>
+
+namespace llvm {
+  using namespace sys;
+
+
+std::string TimeValue::toString() {
+  char buffer[32];
+
+  time_t ourTime = time_t(this->toEpochTime());
+  ::asctime_r(::localtime(&ourTime), buffer);
+
+  std::string result(buffer);
+  return result.substr(0,24);
+}
+
 }
 // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab