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 | 0d455997f845aabe7578d2e9bdc809dc0b06e256 (patch) | |
tree | 7192c6b4867ac62ae2a564374dd0213101d99231 /llvm/lib/System/Unix/TimeValue.cpp | |
parent | 26e2bd44f2d7c6e1526a368a8090505308148874 (diff) | |
download | bcm5719-llvm-0d455997f845aabe7578d2e9bdc809dc0b06e256.tar.gz bcm5719-llvm-0d455997f845aabe7578d2e9bdc809dc0b06e256.zip |
Implement the toString method
llvm-svn: 17782
Diffstat (limited to 'llvm/lib/System/Unix/TimeValue.cpp')
-rw-r--r-- | llvm/lib/System/Unix/TimeValue.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/lib/System/Unix/TimeValue.cpp b/llvm/lib/System/Unix/TimeValue.cpp index 1fbedcab4fe..f029f8dadca 100644 --- a/llvm/lib/System/Unix/TimeValue.cpp +++ b/llvm/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 |