Index: include/experimental/__config =================================================================== --- include/experimental/__config +++ include/experimental/__config @@ -21,4 +21,8 @@ #define _LIBCPP_END_NAMESPACE_LFTS } } } #define _VSTD_LFTS _VSTD_EXPERIMENTAL::fundamentals_v1 +#define _LIBCPP_BEGIN_NAMESPACE_CHRONO_LFTS _LIBCPP_BEGIN_NAMESPACE_STD \ + namespace chrono { namespace experimental { inline namespace fundamentals_v1 { +#define _LIBCPP_END_NAMESPACE_CHRONO_LFTS _LIBCPP_END_NAMESPACE_STD } } } + #endif Index: include/experimental/chrono =================================================================== --- /dev/null +++ include/experimental/chrono @@ -0,0 +1,55 @@ +// -*- C++ -*- +//===------------------------------ chrono ---------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP_EXPERIMENTAL_CHRONO +#define _LIBCPP_EXPERIMENTAL_CHRONO + +/** + experimental/chrono synopsis + +// C++1y + +#include + +namespace std { +namespace chrono { +namespace experimental { +inline namespace fundamentals_v1 { + + // See C++14 20.12.4, customization traits + template constexpr bool treat_as_floating_point_v + = treat_as_floating_point::value; + +} // namespace fundamentals_v1 +} // namespace experimental +} // namespace chrono +} // namespace std + + */ + +#include +#include + +#if _LIBCPP_STD_VER > 11 + +_LIBCPP_BEGIN_NAMESPACE_CHRONO_LFTS + +#if __has_feature(cxx_variable_templates) + +template _LIBCPP_CONSTEXPR bool treat_as_floating_point_v + = treat_as_floating_point<_Rep>::value; + +#endif /* __has_feature(cxx_variable_templates) */ + +_LIBCPP_END_NAMESPACE_CHRONO_LFTS + +#endif /* _LIBCPP_STD_VER > 11 */ + +#endif /* _LIBCPP_EXPERIMENTAL_CHRONO */ \ No newline at end of file Index: test/libcxx/experimental/utilities/time/header.chrono.synop/includes.pass.cpp =================================================================== --- /dev/null +++ test/libcxx/experimental/utilities/time/header.chrono.synop/includes.pass.cpp @@ -0,0 +1,22 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +#include + +#if _LIBCPP_STD_VER > 11 +# ifndef _LIBCPP_CHRONO +# error " must include " +# endif +#endif + +int main() +{ +} Index: test/libcxx/experimental/utilities/time/version.pass.cpp =================================================================== --- /dev/null +++ test/libcxx/experimental/utilities/time/version.pass.cpp @@ -0,0 +1,20 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +#include + +#ifndef _LIBCPP_VERSION +#error _LIBCPP_VERSION not defined +#endif + +int main() +{ +} Index: test/std/experimental/utilities/time/header.chrono.synop/includes.pass.cpp =================================================================== --- /dev/null +++ test/std/experimental/utilities/time/header.chrono.synop/includes.pass.cpp @@ -0,0 +1,19 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +#include + +int main() +{ + // Check that has been included. + std::chrono::seconds s; + ((void)s); +} Index: test/std/experimental/utilities/time/header.chrono.synop/treat_as_floating_point_v.pass.cpp =================================================================== --- /dev/null +++ test/std/experimental/utilities/time/header.chrono.synop/treat_as_floating_point_v.pass.cpp @@ -0,0 +1,49 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +// + +// template constexpr bool treat_as_floating_point_v; + +#include +#include + +namespace ex = std::chrono::experimental; +namespace cr = std::chrono; + +template +void test() +{ + static_assert( + ex::treat_as_floating_point_v == Expect, "" + ); + static_assert( + ex::treat_as_floating_point_v == cr::treat_as_floating_point::value, "" + ); +} + +int main() +{ + { + static_assert( + std::is_same< + decltype(ex::treat_as_floating_point_v), const bool + >::value, "" + ); + } + test(); + test(); + test(); + test(); + test(); + test(); + test(); +}