33 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// test <ctime>10// std::timespec and std::timespec_get11 12// UNSUPPORTED: c++03, c++11, c++1413 14// ::timespec_get is provided by the C library, but it's marked as15// unavailable until macOS 10.1516// 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 TL222// XFAIL: target={{.+}}-aix{{7.2.*|7.3.0.*|7.3.1.*}}23 24#include <ctime>25#include <type_traits>26 27#ifndef TIME_UTC28#error TIME_UTC not defined29#endif30 31std::timespec tmspec = {};32static_assert(std::is_same<decltype(std::timespec_get(&tmspec, 0)), int>::value, "");33