1c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant//===----------------------------------------------------------------------===//
2c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant//
3c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant//                     The LLVM Compiler Infrastructure
4c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant//
5b64f8b07c104c6cc986570ac8ee0ed16a9f23976Howard Hinnant// This file is dual licensed under the MIT and the University of Illinois Open
6b64f8b07c104c6cc986570ac8ee0ed16a9f23976Howard Hinnant// Source Licenses. See LICENSE.TXT for details.
7c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant//
8c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant//===----------------------------------------------------------------------===//
9c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant
10c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant// <chrono>
11c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant
12c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant// duration
13c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant
14c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant// template <class Rep2, class Period2>
15c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant//   duration(const duration<Rep2, Period2>& d);
16c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant
17c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant// inexact conversions allowed for floating point reps
18c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant
19c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant#include <chrono>
20c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant#include <cassert>
21c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant
22c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnantint main()
23c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant{
24473f838128bcf118ab50d08a65a83433ed1b015aHoward Hinnant    {
25c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant    std::chrono::duration<double, std::micro> us(1);
26c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant    std::chrono::duration<double, std::milli> ms = us;
27c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant    assert(ms.count() == 1./1000);
28473f838128bcf118ab50d08a65a83433ed1b015aHoward Hinnant    }
29473f838128bcf118ab50d08a65a83433ed1b015aHoward Hinnant#ifndef _LIBCPP_HAS_NO_CONSTEXPR
30473f838128bcf118ab50d08a65a83433ed1b015aHoward Hinnant    {
31473f838128bcf118ab50d08a65a83433ed1b015aHoward Hinnant    constexpr std::chrono::duration<double, std::micro> us(1);
32473f838128bcf118ab50d08a65a83433ed1b015aHoward Hinnant    constexpr std::chrono::duration<double, std::milli> ms = us;
33473f838128bcf118ab50d08a65a83433ed1b015aHoward Hinnant    static_assert(ms.count() == 1./1000, "");
34473f838128bcf118ab50d08a65a83433ed1b015aHoward Hinnant    }
35473f838128bcf118ab50d08a65a83433ed1b015aHoward Hinnant#endif
36c52f43e72dfcea03037729649da84c23b3beb04aHoward Hinnant}
37