[libcxx-commits] [libcxx] r368299 - Implement hh_mm_ss from P1466R3. Reviewed as https://reviews.llvm.org/D65365.

Marshall Clow via libcxx-commits libcxx-commits at lists.llvm.org
Thu Aug 8 07:36:07 PDT 2019


Author: marshall
Date: Thu Aug  8 07:36:07 2019
New Revision: 368299

URL: http://llvm.org/viewvc/llvm-project?rev=368299&view=rev
Log:
Implement hh_mm_ss from P1466R3. Reviewed as https://reviews.llvm.org/D65365.

Added:
    libcxx/trunk/test/std/utilities/time/time.hms/
    libcxx/trunk/test/std/utilities/time/time.hms/hhmmss.fail.cpp
    libcxx/trunk/test/std/utilities/time/time.hms/time.12/
    libcxx/trunk/test/std/utilities/time/time.hms/time.12/is_am.pass.cpp
    libcxx/trunk/test/std/utilities/time/time.hms/time.12/is_pm.pass.cpp
    libcxx/trunk/test/std/utilities/time/time.hms/time.12/make12.pass.cpp
    libcxx/trunk/test/std/utilities/time/time.hms/time.12/make24.pass.cpp
    libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/
    libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/hours.pass.cpp
    libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/is_negative.pass.cpp
    libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/minutes.pass.cpp
    libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/precision.pass.cpp
    libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/precision_type.pass.cpp
    libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/seconds.pass.cpp
    libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/subseconds.pass.cpp
    libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/to_duration.pass.cpp
    libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/width.pass.cpp
    libcxx/trunk/test/std/utilities/time/time.hms/time.hms.nonmembers/
    libcxx/trunk/test/std/utilities/time/time.hms/time.hms.nonmembers/nothing.to.do.pass.cpp
Modified:
    libcxx/trunk/include/chrono

Modified: libcxx/trunk/include/chrono
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/chrono?rev=368299&r1=368298&r2=368299&view=diff
==============================================================================
--- libcxx/trunk/include/chrono (original)
+++ libcxx/trunk/include/chrono Thu Aug  8 07:36:07 2019
@@ -612,13 +612,43 @@ constexpr year_month_weekday_last
 constexpr year_month_weekday_last
   operator/(const month_weekday_last& mwdl, int y) noexcept;
 
-// 25.9, class template time_of_day    // C++20
-template<class Duration> class time_of_day;
+// 26.9, class template hh_mm_ss
+template <class Duration>
+class hh_mm_ss
+{
+    bool            is_neg; // exposition only
+    chrono::hours   h;      // exposition only
+    chrono::minutes m;      // exposition only
+    chrono::seconds s;      // exposition only
+    precision       ss;     // exposition only
+
+public:
+    static unsigned constexpr fractional_width = see below;
+    using precision                            = see below;
+
+    constexpr hh_mm_ss() noexcept : hh_mm_ss{Duration::zero()} {}
+    constexpr explicit hh_mm_ss(Duration d) noexcept;
+
+    constexpr bool is_negative() const noexcept;
+    constexpr chrono::hours hours() const noexcept;
+    constexpr chrono::minutes minutes() const noexcept;
+    constexpr chrono::seconds seconds() const noexcept;
+    constexpr precision subseconds() const noexcept;
+
+    constexpr explicit operator  precision()   const noexcept;
+    constexpr          precision to_duration() const noexcept;
+};
+
+template <class charT, class traits, class Duration>
+  basic_ostream<charT, traits>&
+    operator<<(basic_ostream<charT, traits>& os, hh_mm_ss<Duration> const& hms);
+
+// 26.10, 12/24 hour functions
+constexpr bool is_am(hours const& h) noexcept;
+constexpr bool is_pm(hours const& h) noexcept;
+constexpr hours make12(const hours& h) noexcept;
+constexpr hours make24(const hours& h, bool is_pm) noexcept;
 
-template<> class time_of_day<hours>;
-template<> class time_of_day<minutes>;
-template<> class time_of_day<seconds>;
-template<class Rep, class Period> class time_of_day<duration<Rep, Period>>;
 
 // 25.10.2, time zone database     // C++20
 struct tzdb;
@@ -2716,6 +2746,84 @@ inline constexpr year_month_weekday_last
 inline constexpr year_month_weekday_last& year_month_weekday_last::operator+=(const years& __dy)  noexcept { *this = *this + __dy; return *this; }
 inline constexpr year_month_weekday_last& year_month_weekday_last::operator-=(const years& __dy)  noexcept { *this = *this - __dy; return *this; }
 
+
+template <class _Duration>
+class hh_mm_ss
+{
+private:
+    static_assert(__is_duration<_Duration>::value, "template parameter of hh_mm_ss must be a std::chrono::duration");
+    using __CommonType = common_type_t<_Duration, chrono::seconds>;
+
+    static constexpr uint64_t __pow10(unsigned __exp)
+    {
+        uint64_t __ret = 1;
+        for (unsigned __i = 0; __i < __exp; ++__i)
+            __ret *= 10U;
+        return __ret;
+    }
+
+    static constexpr unsigned __width(uint64_t __n, uint64_t __d = 10, unsigned __w = 0)
+    {
+        if (__n >= 2 && __d != 0 && __w < 19)
+            return 1 + __width(__n, __d % __n * 10, __w+1);
+        return 0;
+    }
+
+public:
+    static unsigned constexpr fractional_width = __width(__CommonType::period::den) < 19 ?
+                                                 __width(__CommonType::period::den) : 6u;
+    using precision = duration<typename __CommonType::rep, ratio<1, __pow10(fractional_width)>>;
+
+    constexpr hh_mm_ss() noexcept : hh_mm_ss{_Duration::zero()} {}
+
+    constexpr explicit hh_mm_ss(_Duration __d) noexcept :
+        __is_neg(__d < _Duration(0)),
+        __h(duration_cast<chrono::hours>  (abs(__d))),
+        __m(duration_cast<chrono::minutes>(abs(__d) - hours())),
+        __s(duration_cast<chrono::seconds>(abs(__d) - hours() - minutes())),
+        __f(duration_cast<precision>      (abs(__d) - hours() - minutes() - seconds()))
+        {}
+
+    constexpr bool is_negative()        const noexcept { return __is_neg; }
+    constexpr chrono::hours hours()     const noexcept { return __h; }
+    constexpr chrono::minutes minutes() const noexcept { return __m; }
+    constexpr chrono::seconds seconds() const noexcept { return __s; }
+    constexpr precision subseconds()    const noexcept { return __f; }
+
+    constexpr precision to_duration() const noexcept
+    {
+        auto __dur = __h + __m + __s + __f;
+        return __is_neg ? -__dur : __dur;
+    }
+
+    constexpr explicit operator precision() const noexcept { return to_duration(); }
+
+private:
+    bool            __is_neg;
+    chrono::hours   __h;
+    chrono::minutes __m;
+    chrono::seconds __s;
+    precision       __f;
+};
+
+constexpr bool is_am(const hours& __h) noexcept { return __h >= hours( 0) && __h < hours(12); }
+constexpr bool is_pm(const hours& __h) noexcept { return __h >= hours(12) && __h < hours(24); }
+
+constexpr hours make12(const hours& __h) noexcept
+{
+    if      (__h == hours( 0)) return hours(12);
+    else if (__h <= hours(12)) return __h;
+    else                       return __h - hours(12);
+}
+
+constexpr hours make24(const hours& __h, bool __is_pm) noexcept
+{
+    if (__is_pm)
+        return __h == hours(12) ? __h : __h + hours(12);
+    else
+        return __h == hours(12) ? hours(0) : __h;
+}
+
 #endif // _LIBCPP_STD_VER > 17
 } // chrono
 

Added: libcxx/trunk/test/std/utilities/time/time.hms/hhmmss.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/time/time.hms/hhmmss.fail.cpp?rev=368299&view=auto
==============================================================================
--- libcxx/trunk/test/std/utilities/time/time.hms/hhmmss.fail.cpp (added)
+++ libcxx/trunk/test/std/utilities/time/time.hms/hhmmss.fail.cpp Thu Aug  8 07:36:07 2019
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// <chrono>
+
+// template <class Duration> class hh_mm_ss;
+//   If Duration is not an instance of duration, the program is ill-formed.
+
+#include <chrono>
+#include <string>
+#include <cassert>
+#include "test_macros.h"
+
+struct A {};
+
+int main(int, char**)
+{
+    std::chrono::hh_mm_ss<void> h0;        // expected-error-re at chrono:* {{static_assert failed {{.*}} "template parameter of hh_mm_ss must be a std::chrono::duration"}}
+    std::chrono::hh_mm_ss<int> h1;         // expected-error-re at chrono:* {{static_assert failed {{.*}} "template parameter of hh_mm_ss must be a std::chrono::duration"}}
+    std::chrono::hh_mm_ss<std::string> h2; // expected-error-re at chrono:* {{static_assert failed {{.*}} "template parameter of hh_mm_ss must be a std::chrono::duration"}}
+    std::chrono::hh_mm_ss<A> h3;           // expected-error-re at chrono:* {{static_assert failed {{.*}} "template parameter of hh_mm_ss must be a std::chrono::duration"}}
+
+    return 0;
+}

Added: libcxx/trunk/test/std/utilities/time/time.hms/time.12/is_am.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/time/time.hms/time.12/is_am.pass.cpp?rev=368299&view=auto
==============================================================================
--- libcxx/trunk/test/std/utilities/time/time.hms/time.12/is_am.pass.cpp (added)
+++ libcxx/trunk/test/std/utilities/time/time.hms/time.12/is_am.pass.cpp Thu Aug  8 07:36:07 2019
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// <chrono>
+
+// constexpr bool is_am(const hours& h) noexcept;
+//   Returns: 0h <= h && h <= 11h.
+
+#include <chrono>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main(int, char**)
+{
+	using hours = std::chrono::hours;
+	ASSERT_SAME_TYPE(bool, decltype(std::chrono::is_am(std::declval<hours>())));
+	ASSERT_NOEXCEPT(                std::chrono::is_am(std::declval<hours>()));
+
+	static_assert( std::chrono::is_am(hours( 0)), "");
+	static_assert( std::chrono::is_am(hours(11)), "");
+	static_assert(!std::chrono::is_am(hours(12)), "");
+	static_assert(!std::chrono::is_am(hours(23)), "");
+	
+	for (int i = 0; i < 12; ++i)
+		assert( std::chrono::is_am(hours(i)));
+	for (int i = 12; i < 24; ++i)
+		assert(!std::chrono::is_am(hours(i)));
+
+    return 0;
+}

Added: libcxx/trunk/test/std/utilities/time/time.hms/time.12/is_pm.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/time/time.hms/time.12/is_pm.pass.cpp?rev=368299&view=auto
==============================================================================
--- libcxx/trunk/test/std/utilities/time/time.hms/time.12/is_pm.pass.cpp (added)
+++ libcxx/trunk/test/std/utilities/time/time.hms/time.12/is_pm.pass.cpp Thu Aug  8 07:36:07 2019
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// <chrono>
+
+// constexpr bool is_pm(const hours& h) noexcept;
+//   Returns: 12h <= h && h <= 23
+
+#include <chrono>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main(int, char**)
+{
+    using hours = std::chrono::hours;
+    ASSERT_SAME_TYPE(bool, decltype(std::chrono::is_pm(std::declval<hours>())));
+    ASSERT_NOEXCEPT(                std::chrono::is_pm(std::declval<hours>()));
+
+    static_assert(!std::chrono::is_pm(hours( 0)), "");
+    static_assert(!std::chrono::is_pm(hours(11)), "");
+    static_assert( std::chrono::is_pm(hours(12)), "");
+    static_assert( std::chrono::is_pm(hours(23)), "");
+    
+    for (int i = 0; i < 12; ++i)
+        assert(!std::chrono::is_pm(hours(i)));
+    for (int i = 12; i < 24; ++i)
+        assert( std::chrono::is_pm(hours(i)));
+
+    return 0;
+}

Added: libcxx/trunk/test/std/utilities/time/time.hms/time.12/make12.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/time/time.hms/time.12/make12.pass.cpp?rev=368299&view=auto
==============================================================================
--- libcxx/trunk/test/std/utilities/time/time.hms/time.12/make12.pass.cpp (added)
+++ libcxx/trunk/test/std/utilities/time/time.hms/time.12/make12.pass.cpp Thu Aug  8 07:36:07 2019
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// <chrono>
+
+// constexpr hours make12(const hours& h) noexcept;
+//   Returns: The 12-hour equivalent of h in the range [1h, 12h].
+//     If h is not in the range [0h, 23h], the value returned is unspecified.
+
+#include <chrono>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main(int, char**)
+{
+    using hours = std::chrono::hours;
+    ASSERT_SAME_TYPE(hours, decltype(std::chrono::make12(std::declval<hours>())));
+    ASSERT_NOEXCEPT(                 std::chrono::make12(std::declval<hours>()));
+
+    static_assert( std::chrono::make12(hours( 0)) == hours(12), "");
+    static_assert( std::chrono::make12(hours(11)) == hours(11), "");
+    static_assert( std::chrono::make12(hours(12)) == hours(12), "");
+    static_assert( std::chrono::make12(hours(23)) == hours(11), "");
+    
+    assert( std::chrono::make12(hours(0)) == hours(12));
+    for (int i = 1; i < 13; ++i)
+        assert( std::chrono::make12(hours(i)) == hours(i));
+    for (int i = 13; i < 24; ++i)
+        assert( std::chrono::make12(hours(i)) == hours(i-12));
+
+    return 0;
+}

Added: libcxx/trunk/test/std/utilities/time/time.hms/time.12/make24.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/time/time.hms/time.12/make24.pass.cpp?rev=368299&view=auto
==============================================================================
--- libcxx/trunk/test/std/utilities/time/time.hms/time.12/make24.pass.cpp (added)
+++ libcxx/trunk/test/std/utilities/time/time.hms/time.12/make24.pass.cpp Thu Aug  8 07:36:07 2019
@@ -0,0 +1,45 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// <chrono>
+
+// constexpr hours make24(const hours& h, bool is_pm) noexcept;
+//   Returns: If is_pm is false, returns the 24-hour equivalent of h in the range [0h, 11h], 
+//       assuming h represents an ante meridiem hour. 
+//     Else returns the 24-hour equivalent of h in the range [12h, 23h], 
+//       assuming h represents a post meridiem hour. 
+//     If h is not in the range [1h, 12h], the value returned is unspecified.
+
+#include <chrono>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main(int, char**)
+{
+    using hours = std::chrono::hours;
+    ASSERT_SAME_TYPE(hours, decltype(std::chrono::make24(std::declval<hours>(), false)));
+    ASSERT_NOEXCEPT(                 std::chrono::make24(std::declval<hours>(), false));
+
+    static_assert( std::chrono::make24(hours( 1), false) == hours( 1), "");
+    static_assert( std::chrono::make24(hours(11), false) == hours(11), "");
+    static_assert( std::chrono::make24(hours(12), false) == hours( 0), "");
+    static_assert( std::chrono::make24(hours( 1), true)  == hours(13), "");
+    static_assert( std::chrono::make24(hours(11), true)  == hours(23), "");
+    static_assert( std::chrono::make24(hours(12), true)  == hours(12), "");
+    
+    for (int i = 1; i < 11; ++i)
+    {
+        assert((std::chrono::make24(hours(i), false)) == hours(i));
+        assert((std::chrono::make24(hours(i), true))  == hours(12+i));
+    }
+    assert((std::chrono::make24(hours(12), false)) == hours( 0));
+    assert((std::chrono::make24(hours(12), true))  == hours(12));
+
+    return 0;
+}

Added: libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/hours.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/hours.pass.cpp?rev=368299&view=auto
==============================================================================
--- libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/hours.pass.cpp (added)
+++ libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/hours.pass.cpp Thu Aug  8 07:36:07 2019
@@ -0,0 +1,68 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// <chrono>
+
+// template <class Duration>
+// class hh_mm_ss
+// 
+// constexpr chrono::hours hours() const noexcept;
+   
+// Test values
+// duration     hours   minutes seconds fractional
+// 5000s            1       23      20      0
+// 5000 minutes     83      20      0       0
+// 123456789ms      34      17      36      789ms
+// 123456789us      0       2       3       456789us
+// 123456789ns      0       0       0       123456789ns
+// 1000mfn          0       20      9       0.6 (6000/10000)
+// 10000mfn         3       21      36      0
+
+
+#include <chrono>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <typename Duration>
+constexpr long check_hours(Duration d)
+{
+    using HMS = std::chrono::hh_mm_ss<Duration>;
+    ASSERT_SAME_TYPE(std::chrono::hours, decltype(std::declval<HMS>().hours()));
+    ASSERT_NOEXCEPT(                              std::declval<HMS>().hours());
+    return HMS(d).hours().count();
+}
+
+int main(int, char**)
+{
+    using microfortnights = std::chrono::duration<int, std::ratio<756, 625>>;
+    
+    static_assert( check_hours(std::chrono::minutes( 1)) == 0, "");
+    static_assert( check_hours(std::chrono::minutes(-1)) == 0, "");
+    
+    assert( check_hours(std::chrono::seconds( 5000)) == 1);
+    assert( check_hours(std::chrono::seconds(-5000)) == 1);
+    assert( check_hours(std::chrono::minutes( 5000)) == 83);
+    assert( check_hours(std::chrono::minutes(-5000)) == 83);
+    assert( check_hours(std::chrono::hours( 11))     == 11);
+    assert( check_hours(std::chrono::hours(-11))     == 11);
+
+    assert( check_hours(std::chrono::milliseconds( 123456789LL)) == 34);
+    assert( check_hours(std::chrono::milliseconds(-123456789LL)) == 34);
+    assert( check_hours(std::chrono::microseconds( 123456789LL)) ==  0);
+    assert( check_hours(std::chrono::microseconds(-123456789LL)) ==  0);
+    assert( check_hours(std::chrono::nanoseconds( 123456789LL))  ==  0);
+    assert( check_hours(std::chrono::nanoseconds(-123456789LL))  ==  0);
+
+    assert( check_hours(microfortnights(  1000)) == 0);
+    assert( check_hours(microfortnights( -1000)) == 0);
+    assert( check_hours(microfortnights( 10000)) == 3);
+    assert( check_hours(microfortnights(-10000)) == 3);
+
+    return 0;
+}

Added: libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/is_negative.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/is_negative.pass.cpp?rev=368299&view=auto
==============================================================================
--- libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/is_negative.pass.cpp (added)
+++ libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/is_negative.pass.cpp Thu Aug  8 07:36:07 2019
@@ -0,0 +1,54 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// <chrono>
+
+// template <class Duration>
+// class hh_mm_ss
+// 
+// constexpr bool is_negative() const noexcept;
+
+#include <chrono>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <typename Duration>
+constexpr bool check_neg(Duration d)
+{
+	ASSERT_SAME_TYPE(bool, decltype(std::declval<std::chrono::hh_mm_ss<Duration>>().is_negative()));
+	ASSERT_NOEXCEPT(                std::declval<std::chrono::hh_mm_ss<Duration>>().is_negative());
+	return std::chrono::hh_mm_ss<Duration>(d).is_negative();
+}
+
+int main(int, char**)
+{
+	using microfortnights = std::chrono::duration<int, std::ratio<756, 625>>;
+	
+	static_assert(!check_neg(std::chrono::minutes( 1)), "");
+	static_assert( check_neg(std::chrono::minutes(-1)), "");
+	
+	assert(!check_neg(std::chrono::seconds( 5000)));
+	assert( check_neg(std::chrono::seconds(-5000)));
+	assert(!check_neg(std::chrono::minutes( 5000)));
+	assert( check_neg(std::chrono::minutes(-5000)));
+	assert(!check_neg(std::chrono::hours( 11)));
+	assert( check_neg(std::chrono::hours(-11)));
+
+	assert(!check_neg(std::chrono::milliseconds( 123456789LL)));
+	assert( check_neg(std::chrono::milliseconds(-123456789LL)));
+	assert(!check_neg(std::chrono::microseconds( 123456789LL)));
+	assert( check_neg(std::chrono::microseconds(-123456789LL)));
+	assert(!check_neg(std::chrono::nanoseconds( 123456789LL)));
+	assert( check_neg(std::chrono::nanoseconds(-123456789LL)));
+
+	assert(!check_neg(microfortnights( 10000)));
+	assert( check_neg(microfortnights(-10000)));
+
+	return 0;
+}

Added: libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/minutes.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/minutes.pass.cpp?rev=368299&view=auto
==============================================================================
--- libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/minutes.pass.cpp (added)
+++ libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/minutes.pass.cpp Thu Aug  8 07:36:07 2019
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// <chrono>
+
+// template <class Duration>
+// class hh_mm_ss
+// 
+// constexpr chrono::minutes minutes() const noexcept;
+//
+// See the table in hours.pass.cpp for correspondence between the magic values used below
+
+#include <chrono>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <typename Duration>
+constexpr long check_minutes(Duration d)
+{
+    using HMS = std::chrono::hh_mm_ss<Duration>;
+    ASSERT_SAME_TYPE(std::chrono::minutes, decltype(std::declval<HMS>().minutes()));
+    ASSERT_NOEXCEPT(                                std::declval<HMS>().minutes());
+    return HMS(d).minutes().count();
+}
+
+int main(int, char**)
+{
+    using microfortnights = std::chrono::duration<int, std::ratio<756, 625>>;
+    
+    static_assert( check_minutes(std::chrono::minutes( 1)) == 1, "");
+    static_assert( check_minutes(std::chrono::minutes(-1)) == 1, "");
+    
+    assert( check_minutes(std::chrono::seconds( 5000)) == 23);
+    assert( check_minutes(std::chrono::seconds(-5000)) == 23);
+    assert( check_minutes(std::chrono::minutes( 5000)) == 20);
+    assert( check_minutes(std::chrono::minutes(-5000)) == 20);
+    assert( check_minutes(std::chrono::hours( 11))     == 0);
+    assert( check_minutes(std::chrono::hours(-11))     == 0);
+
+    assert( check_minutes(std::chrono::milliseconds( 123456789LL)) == 17);
+    assert( check_minutes(std::chrono::milliseconds(-123456789LL)) == 17);
+    assert( check_minutes(std::chrono::microseconds( 123456789LL)) == 2);
+    assert( check_minutes(std::chrono::microseconds(-123456789LL)) == 2);
+    assert( check_minutes(std::chrono::nanoseconds( 123456789LL))  == 0);
+    assert( check_minutes(std::chrono::nanoseconds(-123456789LL))  == 0);
+
+    assert( check_minutes(microfortnights(  1000)) == 20);
+    assert( check_minutes(microfortnights( -1000)) == 20);
+    assert( check_minutes(microfortnights( 10000)) == 21);
+    assert( check_minutes(microfortnights(-10000)) == 21);
+
+    return 0;
+}

Added: libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/precision.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/precision.pass.cpp?rev=368299&view=auto
==============================================================================
--- libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/precision.pass.cpp (added)
+++ libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/precision.pass.cpp Thu Aug  8 07:36:07 2019
@@ -0,0 +1,80 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// <chrono>
+
+// template <class Duration>
+// class hh_mm_ss
+// {
+// public:
+//     static unsigned constexpr fractional_width = see below;
+//     using precision                            = see below;
+//
+//   precision is duration<common_type_t<Duration::rep, seconds::rep>, 
+//                                 ratio<1, 10^^fractional_width>>
+   
+#include <chrono>
+#include <cassert>
+
+#include "test_macros.h"
+
+constexpr unsigned long long powers[] = {
+	1ULL,
+	10ULL,
+	100ULL,
+	1000ULL,
+	10000ULL,
+	100000ULL,
+	1000000ULL,
+	10000000ULL,
+	100000000ULL,
+	1000000000ULL,
+	10000000000ULL,
+	100000000000ULL,
+	1000000000000ULL,
+	10000000000000ULL,
+	100000000000000ULL,
+	1000000000000000ULL,
+	10000000000000000ULL,
+	100000000000000000ULL,
+	1000000000000000000ULL,
+	10000000000000000000ULL
+	};
+	
+template <typename Duration, unsigned width>
+constexpr bool check_precision()
+{
+	using HMS = std::chrono::hh_mm_ss<Duration>;
+	using CT  = std::common_type_t<typename Duration::rep, std::chrono::seconds::rep>;
+	using Pre = std::chrono::duration<CT, std::ratio<1, powers[width]>>;
+	return std::is_same_v<typename HMS::precision, Pre>;
+}
+
+int main(int, char**)
+{
+	using microfortnights = std::chrono::duration<int, std::ratio<756, 625>>;
+
+	static_assert( check_precision<std::chrono::hours,                               0>(), "");
+	static_assert( check_precision<std::chrono::minutes,                             0>(), "");
+	static_assert( check_precision<std::chrono::seconds,                             0>(), "");
+	static_assert( check_precision<std::chrono::milliseconds,                        3>(), "");
+	static_assert( check_precision<std::chrono::microseconds,                        6>(), "");
+	static_assert( check_precision<std::chrono::nanoseconds,                         9>(), "");
+	static_assert( check_precision<std::chrono::duration<int, std::ratio<  1,   2>>, 1>(), "");
+	static_assert( check_precision<std::chrono::duration<int, std::ratio<  1,   3>>, 6>(), "");
+	static_assert( check_precision<std::chrono::duration<int, std::ratio<  1,   4>>, 2>(), "");
+	static_assert( check_precision<std::chrono::duration<int, std::ratio<  1,   5>>, 1>(), "");
+	static_assert( check_precision<std::chrono::duration<int, std::ratio<  1,   6>>, 6>(), "");
+	static_assert( check_precision<std::chrono::duration<int, std::ratio<  1,   7>>, 6>(), "");
+	static_assert( check_precision<std::chrono::duration<int, std::ratio<  1,   8>>, 3>(), "");
+	static_assert( check_precision<std::chrono::duration<int, std::ratio<  1,   9>>, 6>(), "");
+	static_assert( check_precision<std::chrono::duration<int, std::ratio<  1,  10>>, 1>(), "");
+	static_assert( check_precision<microfortnights,                                  4>(), "");
+
+	return 0;
+}

Added: libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/precision_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/precision_type.pass.cpp?rev=368299&view=auto
==============================================================================
--- libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/precision_type.pass.cpp (added)
+++ libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/precision_type.pass.cpp Thu Aug  8 07:36:07 2019
@@ -0,0 +1,80 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// <chrono>
+
+// template <class Duration>
+// class hh_mm_ss
+// {
+// public:
+//     static unsigned constexpr fractional_width = see below;
+//     using precision                            = see below;
+//
+//   precision is duration<common_type_t<Duration::rep, seconds::rep>, 
+//                                 ratio<1, 10^^fractional_width>>
+   
+#include <chrono>
+#include <cassert>
+
+#include "test_macros.h"
+
+constexpr unsigned long long powers[] = {
+	1ULL,
+	10ULL,
+	100ULL,
+	1000ULL,
+	10000ULL,
+	100000ULL,
+	1000000ULL,
+	10000000ULL,
+	100000000ULL,
+	1000000000ULL,
+	10000000000ULL,
+	100000000000ULL,
+	1000000000000ULL,
+	10000000000000ULL,
+	100000000000000ULL,
+	1000000000000000ULL,
+	10000000000000000ULL,
+	100000000000000000ULL,
+	1000000000000000000ULL,
+	10000000000000000000ULL
+	};
+	
+template <typename Duration, unsigned width>
+constexpr bool check_precision()
+{
+	using HMS = std::chrono::hh_mm_ss<Duration>;
+	using CT  = std::common_type_t<typename Duration::rep, std::chrono::seconds::rep>;
+	using Pre = std::chrono::duration<CT, std::ratio<1, powers[width]>>;
+	return std::is_same_v<typename HMS::precision, Pre>;
+}
+
+int main(int, char**)
+{
+	using microfortnights = std::chrono::duration<int, std::ratio<756, 625>>;
+
+	static_assert( check_precision<std::chrono::hours,                               0>(), "");
+	static_assert( check_precision<std::chrono::minutes,                             0>(), "");
+	static_assert( check_precision<std::chrono::seconds,                             0>(), "");
+	static_assert( check_precision<std::chrono::milliseconds,                        3>(), "");
+	static_assert( check_precision<std::chrono::microseconds,                        6>(), "");
+	static_assert( check_precision<std::chrono::nanoseconds,                         9>(), "");
+	static_assert( check_precision<std::chrono::duration<int, std::ratio<  1,   2>>, 1>(), "");
+	static_assert( check_precision<std::chrono::duration<int, std::ratio<  1,   3>>, 6>(), "");
+	static_assert( check_precision<std::chrono::duration<int, std::ratio<  1,   4>>, 2>(), "");
+	static_assert( check_precision<std::chrono::duration<int, std::ratio<  1,   5>>, 1>(), "");
+	static_assert( check_precision<std::chrono::duration<int, std::ratio<  1,   6>>, 6>(), "");
+	static_assert( check_precision<std::chrono::duration<int, std::ratio<  1,   7>>, 6>(), "");
+	static_assert( check_precision<std::chrono::duration<int, std::ratio<  1,   8>>, 3>(), "");
+	static_assert( check_precision<std::chrono::duration<int, std::ratio<  1,   9>>, 6>(), "");
+	static_assert( check_precision<std::chrono::duration<int, std::ratio<  1,  10>>, 1>(), "");
+	static_assert( check_precision<microfortnights,                                  4>(), "");
+
+	return 0;
+}

Added: libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/seconds.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/seconds.pass.cpp?rev=368299&view=auto
==============================================================================
--- libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/seconds.pass.cpp (added)
+++ libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/seconds.pass.cpp Thu Aug  8 07:36:07 2019
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// <chrono>
+
+// template <class Duration>
+// class hh_mm_ss
+// 
+// constexpr chrono::seconds seconds() const noexcept;
+//
+// See the table in hours.pass.cpp for correspondence between the magic values used below
+
+#include <chrono>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <typename Duration>
+constexpr long check_seconds(Duration d)
+{
+    using HMS = std::chrono::hh_mm_ss<Duration>;
+    ASSERT_SAME_TYPE(std::chrono::seconds, decltype(std::declval<HMS>().seconds()));
+    ASSERT_NOEXCEPT(                                std::declval<HMS>().seconds());
+    return HMS(d).seconds().count();
+}
+
+int main(int, char**)
+{
+    using microfortnights = std::chrono::duration<int, std::ratio<756, 625>>;
+    
+    static_assert( check_seconds(std::chrono::seconds( 1)) == 1, "");
+    static_assert( check_seconds(std::chrono::seconds(-1)) == 1, "");
+    
+    assert( check_seconds(std::chrono::seconds( 5000)) == 20);
+    assert( check_seconds(std::chrono::seconds(-5000)) == 20);
+    assert( check_seconds(std::chrono::minutes( 5000)) == 0);
+    assert( check_seconds(std::chrono::minutes(-5000)) == 0);
+    assert( check_seconds(std::chrono::hours( 11))     == 0);
+    assert( check_seconds(std::chrono::hours(-11))     == 0);
+
+    assert( check_seconds(std::chrono::milliseconds( 123456789LL)) == 36);
+    assert( check_seconds(std::chrono::milliseconds(-123456789LL)) == 36);
+    assert( check_seconds(std::chrono::microseconds( 123456789LL)) == 3);
+    assert( check_seconds(std::chrono::microseconds(-123456789LL)) == 3);
+    assert( check_seconds(std::chrono::nanoseconds( 123456789LL))  == 0);
+    assert( check_seconds(std::chrono::nanoseconds(-123456789LL))  == 0);
+
+    assert( check_seconds(microfortnights(  1000)) ==  9);
+    assert( check_seconds(microfortnights( -1000)) ==  9);
+    assert( check_seconds(microfortnights( 10000)) == 36);
+    assert( check_seconds(microfortnights(-10000)) == 36);
+
+    return 0;
+}

Added: libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/subseconds.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/subseconds.pass.cpp?rev=368299&view=auto
==============================================================================
--- libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/subseconds.pass.cpp (added)
+++ libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/subseconds.pass.cpp Thu Aug  8 07:36:07 2019
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// <chrono>
+
+// template <class Duration>
+// class hh_mm_ss
+// 
+// constexpr precision subseconds() const noexcept;
+//
+// See the table in hours.pass.cpp for correspondence between the magic values used below
+
+#include <chrono>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <typename Duration>
+constexpr long check_subseconds(Duration d)
+{
+    using HMS = std::chrono::hh_mm_ss<Duration>;
+    ASSERT_SAME_TYPE(typename HMS::precision, decltype(std::declval<HMS>().subseconds()));
+    ASSERT_NOEXCEPT(                                   std::declval<HMS>().subseconds());
+    return HMS(d).subseconds().count();
+}
+
+int main(int, char**)
+{
+    using microfortnights = std::chrono::duration<int, std::ratio<756, 625>>;
+    
+    static_assert( check_subseconds(std::chrono::seconds( 1)) == 0, "");
+    static_assert( check_subseconds(std::chrono::seconds(-1)) == 0, "");
+    
+    assert( check_subseconds(std::chrono::seconds( 5000)) == 0);
+    assert( check_subseconds(std::chrono::seconds(-5000)) == 0);
+    assert( check_subseconds(std::chrono::minutes( 5000)) == 0);
+    assert( check_subseconds(std::chrono::minutes(-5000)) == 0);
+    assert( check_subseconds(std::chrono::hours( 11))     == 0);
+    assert( check_subseconds(std::chrono::hours(-11))     == 0);
+
+    assert( check_subseconds(std::chrono::milliseconds( 123456789LL)) == 789);
+    assert( check_subseconds(std::chrono::milliseconds(-123456789LL)) == 789);
+    assert( check_subseconds(std::chrono::microseconds( 123456789LL)) == 456789LL);
+    assert( check_subseconds(std::chrono::microseconds(-123456789LL)) == 456789LL);
+    assert( check_subseconds(std::chrono::nanoseconds( 123456789LL))  == 123456789LL);
+    assert( check_subseconds(std::chrono::nanoseconds(-123456789LL))  == 123456789LL);
+
+    assert( check_subseconds(microfortnights(  1000)) == 6000);
+    assert( check_subseconds(microfortnights( -1000)) == 6000);
+    assert( check_subseconds(microfortnights( 10000)) == 0);
+    assert( check_subseconds(microfortnights(-10000)) == 0);
+
+    return 0;
+}

Added: libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/to_duration.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/to_duration.pass.cpp?rev=368299&view=auto
==============================================================================
--- libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/to_duration.pass.cpp (added)
+++ libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/to_duration.pass.cpp Thu Aug  8 07:36:07 2019
@@ -0,0 +1,60 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// <chrono>
+
+// template <class Duration>
+// class hh_mm_ss
+// 
+// constexpr precision to_duration() const noexcept;
+//
+// See the table in hours.pass.cpp for correspondence between the magic values used below
+
+#include <chrono>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <typename Duration>
+constexpr long long check_duration(Duration d)
+{
+    using HMS = std::chrono::hh_mm_ss<Duration>;
+    ASSERT_SAME_TYPE(typename HMS::precision, decltype(std::declval<HMS>().to_duration()));
+    ASSERT_NOEXCEPT(                                   std::declval<HMS>().to_duration());
+    
+    return HMS(d).to_duration().count();
+}
+
+int main(int, char**)
+{
+    using microfortnights = std::chrono::duration<int, std::ratio<756, 625>>;
+    
+    static_assert( check_duration(std::chrono::minutes( 1)) ==  60, "");
+    static_assert( check_duration(std::chrono::minutes(-1)) == -60, "");
+
+    assert( check_duration(std::chrono::seconds( 5000)) ==    5000LL);
+    assert( check_duration(std::chrono::seconds(-5000)) ==   -5000LL);
+    assert( check_duration(std::chrono::minutes( 5000)) ==  300000LL);
+    assert( check_duration(std::chrono::minutes(-5000)) == -300000LL);
+    assert( check_duration(std::chrono::hours( 11))     ==   39600LL);
+    assert( check_duration(std::chrono::hours(-11))     ==  -39600LL);
+
+    assert( check_duration(std::chrono::milliseconds( 123456789LL)) ==  123456789LL);
+    assert( check_duration(std::chrono::milliseconds(-123456789LL)) == -123456789LL);
+    assert( check_duration(std::chrono::microseconds( 123456789LL)) ==  123456789LL);
+    assert( check_duration(std::chrono::microseconds(-123456789LL)) == -123456789LL);
+    assert( check_duration(std::chrono::nanoseconds( 123456789LL))  ==  123456789LL);
+    assert( check_duration(std::chrono::nanoseconds(-123456789LL))  == -123456789LL);
+
+    assert( check_duration(microfortnights(  1000)) ==   12096000);
+    assert( check_duration(microfortnights( -1000)) ==  -12096000);
+    assert( check_duration(microfortnights( 10000)) ==  120960000);
+    assert( check_duration(microfortnights(-10000)) == -120960000);
+
+    return 0;
+}

Added: libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/width.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/width.pass.cpp?rev=368299&view=auto
==============================================================================
--- libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/width.pass.cpp (added)
+++ libcxx/trunk/test/std/utilities/time/time.hms/time.hms.members/width.pass.cpp Thu Aug  8 07:36:07 2019
@@ -0,0 +1,58 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// <chrono>
+
+// template <class Duration>
+// class hh_mm_ss
+// {
+// public:
+//     static unsigned constexpr fractional_width = see below;
+//     using precision                            = see below;
+//
+//	fractional_width is the number of fractional decimal digits represented by precision. 
+//  fractional_width has the value of the smallest possible integer in the range [0, 18] 
+//    such that precision will exactly represent all values of Duration. 
+//  If no such value of fractional_width exists, then fractional_width is 6.
+
+   
+#include <chrono>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <typename Duration, unsigned width>
+constexpr bool check_width()
+{
+	using HMS = std::chrono::hh_mm_ss<Duration>;
+	return HMS::fractional_width == width;
+}
+
+int main(int, char**)
+{
+	using microfortnights = std::chrono::duration<int, std::ratio<756, 625>>;
+
+	static_assert( check_width<std::chrono::hours,                               0>(), "");
+	static_assert( check_width<std::chrono::minutes,                             0>(), "");
+	static_assert( check_width<std::chrono::seconds,                             0>(), "");
+	static_assert( check_width<std::chrono::milliseconds,                        3>(), "");
+	static_assert( check_width<std::chrono::microseconds,                        6>(), "");
+	static_assert( check_width<std::chrono::nanoseconds,                         9>(), "");
+	static_assert( check_width<std::chrono::duration<int, std::ratio<  1,   2>>, 1>(), "");
+	static_assert( check_width<std::chrono::duration<int, std::ratio<  1,   3>>, 6>(), "");
+	static_assert( check_width<std::chrono::duration<int, std::ratio<  1,   4>>, 2>(), "");
+	static_assert( check_width<std::chrono::duration<int, std::ratio<  1,   5>>, 1>(), "");
+	static_assert( check_width<std::chrono::duration<int, std::ratio<  1,   6>>, 6>(), "");
+	static_assert( check_width<std::chrono::duration<int, std::ratio<  1,   7>>, 6>(), "");
+	static_assert( check_width<std::chrono::duration<int, std::ratio<  1,   8>>, 3>(), "");
+	static_assert( check_width<std::chrono::duration<int, std::ratio<  1,   9>>, 6>(), "");
+	static_assert( check_width<std::chrono::duration<int, std::ratio<  1,  10>>, 1>(), "");
+	static_assert( check_width<microfortnights,                                  4>(), "");
+
+	return 0;
+}

Added: libcxx/trunk/test/std/utilities/time/time.hms/time.hms.nonmembers/nothing.to.do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/time/time.hms/time.hms.nonmembers/nothing.to.do.pass.cpp?rev=368299&view=auto
==============================================================================
--- libcxx/trunk/test/std/utilities/time/time.hms/time.hms.nonmembers/nothing.to.do.pass.cpp (added)
+++ libcxx/trunk/test/std/utilities/time/time.hms/time.hms.nonmembers/nothing.to.do.pass.cpp Thu Aug  8 07:36:07 2019
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <chrono>
+
+// template <class Duration> class hh_mm_ss;
+
+#include <chrono>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main(int, char**)
+{
+    return 0;
+}




More information about the libcxx-commits mailing list