diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-07-11 15:35:23 +0000 |
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-07-11 15:35:23 +0000 |
| commit | b1c1c5f37734770f7ecef3d83f26e130ca4a4c9e (patch) | |
| tree | 0798d43d7a234c68796bec9ccb455c9976faea80 /llvm/lib/Support/Windows | |
| parent | c815a4e2977b33d6fd9f7dc2acf2126b5ecd369f (diff) | |
| download | bcm5719-llvm-b1c1c5f37734770f7ecef3d83f26e130ca4a4c9e.tar.gz bcm5719-llvm-b1c1c5f37734770f7ecef3d83f26e130ca4a4c9e.zip | |
Fix a FIXME about the format and add a test.
While at it, use strftime on Unix too and use the thread safe versions
of localtime.
llvm-svn: 186090
Diffstat (limited to 'llvm/lib/Support/Windows')
| -rw-r--r-- | llvm/lib/Support/Windows/TimeValue.inc | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/llvm/lib/Support/Windows/TimeValue.inc b/llvm/lib/Support/Windows/TimeValue.inc index 12275526f1c..32983be883f 100644 --- a/llvm/lib/Support/Windows/TimeValue.inc +++ b/llvm/lib/Support/Windows/TimeValue.inc @@ -31,20 +31,15 @@ TimeValue TimeValue::now() { } std::string TimeValue::str() const { -#ifdef __MINGW32__ - // This ban may be lifted by either: - // (i) a future MinGW version other than 1.0 inherents the __time64_t type, or - // (ii) configure tests for either the time_t or __time64_t type. - time_t ourTime = time_t(this->toEpochTime()); - struct tm *lt = ::localtime(&ourTime); -#else - __time64_t ourTime = this->toEpochTime(); - struct tm *lt = ::_localtime64(&ourTime); -#endif - - char buffer[25]; - strftime(buffer, 25, "%a %b %d %H:%M:%S %Y", lt); - return std::string(buffer); + struct tm LT; + __time64_t OurTime = this->toEpochTime(); + errno_t Error = ::_localtime64_s(<, &OurTime); + assert(!Error); + + char Buffer[25]; + // FIXME: the windows version of strftime doesn't support %e + strftime(Buffer, 25, "%b %d %H:%M %Y", <); + return std::string(Buffer); } |

