From 59838f7ea675e5b3251d730b59325786b3f6e68c Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Thu, 20 Oct 2016 12:05:50 +0000 Subject: 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 --- llvm/unittests/Support/TimeValueTest.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'llvm/unittests/Support/TimeValueTest.cpp') 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()); +} } -- cgit v1.2.3