diff options
Diffstat (limited to 'lib/System/Unix')
-rw-r--r-- | lib/System/Unix/TimeValue.cpp | 16 | ||||
-rw-r--r-- | lib/System/Unix/TimeValue.inc | 16 |
2 files changed, 32 insertions, 0 deletions
diff --git a/lib/System/Unix/TimeValue.cpp b/lib/System/Unix/TimeValue.cpp index 1fbedcab4f..f029f8dadc 100644 --- a/lib/System/Unix/TimeValue.cpp +++ b/lib/System/Unix/TimeValue.cpp @@ -18,5 +18,21 @@ #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 diff --git a/lib/System/Unix/TimeValue.inc b/lib/System/Unix/TimeValue.inc index 1fbedcab4f..f029f8dadc 100644 --- a/lib/System/Unix/TimeValue.inc +++ b/lib/System/Unix/TimeValue.inc @@ -18,5 +18,21 @@ #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 |