xref: /llvm-project/libcxx/test/std/language.support/support.runtime/ctime.timespec.compile.pass.cpp (revision f87e9d42c70476b63f4c87e52651f653f7e2f036)
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 // ::timespec_get is provided by the C library, but it's marked as
15 // unavailable until macOS 10.15
16 // XFAIL: target={{.+}}-apple-macosx10.{{13|14}}
17 
18 // ::timespec_get is available starting with Android Q (API 29)
19 // XFAIL: target={{.+}}-android{{(eabi)?(21|22|23|24|25|26|27|28)}}
20 
21 // ::timespec_get is available starting with AIX 7.3 TL2
22 // XFAIL: target={{.+}}-aix{{7.2.*|7.3.0.*|7.3.1.*}}
23 
24 #include <ctime>
25 #include <type_traits>
26 
27 #ifndef TIME_UTC
28 #error TIME_UTC not defined
29 #endif
30 
31 std::timespec tmspec = {};
32 static_assert(std::is_same<decltype(std::timespec_get(&tmspec, 0)), int>::value, "");
33