summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Support/TimeValueTest.cpp
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2016-10-20 12:05:50 +0000
committerPavel Labath <labath@google.com>2016-10-20 12:05:50 +0000
commit59838f7ea675e5b3251d730b59325786b3f6e68c (patch)
treef50f3228bc160702ef564458d9b7d87337cd8d26 /llvm/unittests/Support/TimeValueTest.cpp
parent157e46dd45e7833d0fe765d26ed4993619bc05b3 (diff)
downloadbcm5719-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/unittests/Support/TimeValueTest.cpp')
-rw-r--r--llvm/unittests/Support/TimeValueTest.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/unittests/Support/TimeValueTest.cpp b/llvm/unittests/Support/TimeValueTest.cpp
index 3d2b9780c06..9e8690f57bc 100644
--- a/llvm/unittests/Support/TimeValueTest.cpp
+++ b/llvm/unittests/Support/TimeValueTest.cpp
@@ -37,4 +37,14 @@ TEST(TimeValue, Win32FILETIME) {
EXPECT_EQ(ft1970, epoch.toWin32Time());
}
+TEST(TimeValue, Chrono) {
+ sys::TimeValue TV;
+ TV.fromEpochTime(0);
+ sys::TimePoint<> TP = TV;
+ EXPECT_EQ(0u, sys::toTimeT(TP));
+
+ TP += std::chrono::seconds(47);
+ TV = TP;
+ EXPECT_EQ(47u, TV.toEpochTime());
+}
}
OpenPOWER on IntegriCloud