xref: /llvm-project/libcxx/test/std/time/time.clock/time.clock.file/now.pass.cpp (revision f0617d2def86192c15c9194281ef3f843effed55)
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // UNSUPPORTED: c++03, c++11, c++14, c++17
10 
11 // UNSUPPORTED: availability-filesystem-missing
12 
13 // <chrono>
14 
15 // file_clock
16 
17 // static time_point now() noexcept;
18 
19 #include <chrono>
20 #include <cassert>
21 
22 #include "test_macros.h"
23 
24 int main(int, char**)
25 {
26     typedef std::chrono::file_clock C;
27     ASSERT_NOEXCEPT(C::now());
28 
29     C::time_point t1 = C::now();
30     assert(t1.time_since_epoch().count() != 0);
31     assert(C::time_point::min() < t1);
32     assert(C::time_point::max() > t1);
33 
34   return 0;
35 }
36