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 // test <ctime>
10 // std::timespec and std::timespec_get
11 
12 // UNSUPPORTED: c++03, c++11, c++14
13 
14 // XFAIL: LIBCXX-AIX-FIXME
15 
16 // ::timespec_get is provided by the C library, but it's marked as
17 // unavailable until macOS 10.15
18 // XFAIL: use_system_cxx_lib && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
19 
20 // MinGW used to lack timespec_get, but has got it in newer versions.
21 // Mark the test as unsupported for a transition period, to avoid spurious
22 // failures when upgrading the precommit testing environment. After
23 // the testing environment is upgraded, we could remove the marking altogether.
24 // UNSUPPORTED: target={{.+}}-windows-gnu
25 
26 #include <ctime>
27 #include <type_traits>
28 
29 #ifndef TIME_UTC
30 #error TIME_UTC not defined
31 #endif
32 
33 std::timespec tmspec = {};
34 static_assert(std::is_same<decltype(std::timespec_get(&tmspec, 0)), int>::value, "");
35