diff options
author | Pavel Labath <labath@google.com> | 2016-10-20 12:05:50 +0000 |
---|---|---|
committer | Pavel Labath <labath@google.com> | 2016-10-20 12:05:50 +0000 |
commit | 59838f7ea675e5b3251d730b59325786b3f6e68c (patch) | |
tree | f50f3228bc160702ef564458d9b7d87337cd8d26 /llvm/lib/Support/TimeValue.cpp | |
parent | 157e46dd45e7833d0fe765d26ed4993619bc05b3 (diff) | |
download | bcm5719-llvm-59838f7ea675e5b3251d730b59325786b3f6e68c.tar.gz bcm5719-llvm-59838f7ea675e5b3251d730b59325786b3f6e68c.zip |
Reapply "Add Chrono.h - std::chrono support header"
This is a resubmission of r284590. The mingw build should be fixed now. The
problem was we were matching time_t with _localtime_64s, which was incorrect on
_USE_32BIT_TIME_T systems. Instead I use localtime_s, which should always
evaluate to the correct function.
llvm-svn: 284720
Diffstat (limited to 'llvm/lib/Support/TimeValue.cpp')
-rw-r--r-- | llvm/lib/Support/TimeValue.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/llvm/lib/Support/TimeValue.cpp b/llvm/lib/Support/TimeValue.cpp index 94a4c011693..18c84ca9fa0 100644 --- a/llvm/lib/Support/TimeValue.cpp +++ b/llvm/lib/Support/TimeValue.cpp @@ -12,7 +12,8 @@ //===----------------------------------------------------------------------===// #include "llvm/Support/TimeValue.h" -#include "llvm/Config/config.h" +#include "llvm/Support/Chrono.h" +#include "llvm/Support/ScopedPrinter.h" namespace llvm { @@ -45,12 +46,10 @@ void TimeValue::normalize() { } } -} // namespace llvm +std::string TimeValue::str() const { return to_string(TimePoint<>(*this)); } + +TimeValue TimeValue::now() { + return TimePoint<>(std::chrono::system_clock::now()); +} -/// Include the platform-specific portion of TimeValue class -#ifdef LLVM_ON_UNIX -#include "Unix/TimeValue.inc" -#endif -#ifdef LLVM_ON_WIN32 -#include "Windows/TimeValue.inc" -#endif +} // namespace llvm |