1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // UNSUPPORTED: c++98, c++03
11 
12 // <filesystem>
13 
14 // typedef TrivialClock file_time_type;
15 
16 #include "filesystem_include.hpp"
17 #include <chrono>
18 #include <type_traits>
19 
20 #include "test_macros.h"
21 
22 // system_clock is used because it meets the requirements of TrivialClock,
23 // and the resolution and range of system_clock should match the operating
24 // system's file time type.
25 
test_trivial_clock()26 void test_trivial_clock() {
27   using namespace fs;
28   using Clock = file_time_type::clock;
29   ASSERT_NOEXCEPT(Clock::now());
30   ASSERT_SAME_TYPE(decltype(Clock::now()), file_time_type);
31   ASSERT_SAME_TYPE(Clock::time_point, file_time_type);
32   volatile auto* odr_use = &Clock::is_steady;
33   ((void)odr_use);
34 }
35 
test_time_point_resolution_and_range()36 void test_time_point_resolution_and_range() {
37   using namespace fs;
38   using Dur = file_time_type::duration;
39   using Period = Dur::period;
40   ASSERT_SAME_TYPE(Period, std::nano);
41 }
42 
main()43 int main() {
44   test_trivial_clock();
45   test_time_point_resolution_and_range();
46 }
47