Debian Codegraph @

libcxx/test/std/language.support/support.runtime/ctime.timespec.compile.pass.cpp

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