aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Support/Unix
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Support/Unix')
-rw-r--r--lib/Support/Unix/TimeValue.inc19
1 files changed, 7 insertions, 12 deletions
diff --git a/lib/Support/Unix/TimeValue.inc b/lib/Support/Unix/TimeValue.inc
index df8558b..80532b0 100644
--- a/lib/Support/Unix/TimeValue.inc
+++ b/lib/Support/Unix/TimeValue.inc
@@ -22,18 +22,13 @@ namespace llvm {
using namespace sys;
std::string TimeValue::str() const {
- char buffer[32];
-
- time_t ourTime = time_t(this->toEpochTime());
-#ifdef __hpux
-// note that the following line needs -D_REENTRANT on HP-UX to be picked up
- asctime_r(localtime(&ourTime), buffer);
-#else
- ::asctime_r(::localtime(&ourTime), buffer);
-#endif
-
- std::string result(buffer);
- return result.substr(0,24);
+ time_t OurTime = time_t(this->toEpochTime());
+ struct tm Storage;
+ struct tm *LT = ::localtime_r(&OurTime, &Storage);
+ assert(LT);
+ char Buffer[25];
+ strftime(Buffer, 25, "%b %e %H:%M %Y", LT);
+ return std::string(Buffer);
}
TimeValue TimeValue::now() {