diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2004-11-14 22:10:08 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2004-11-14 22:10:08 +0000 |
commit | d351871d9b2cd7788274a47a2b8a23dbba663288 (patch) | |
tree | 968059fbaa647f5a58e71411c6178ca7664c4fdb /lib/System/Unix/TimeValue.inc | |
parent | 944655922ea9ffc2b76382ccb8d9a958ef878df2 (diff) |
Implement the toString method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17782 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/System/Unix/TimeValue.inc')
-rw-r--r-- | lib/System/Unix/TimeValue.inc | 16 |
1 files changed, 16 insertions, 0 deletions
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 |