2 //===----------------------------------------------------------------------===//
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8 //===----------------------------------------------------------------------===//
34 double difftime(time_t time1, time_t time0);
35 time_t mktime(tm* timeptr);
36 time_t time(time_t* timer);
37 char* asctime(const tm* timeptr);
38 char* ctime(const time_t* timer);
39 tm* gmtime(const time_t* timer);
40 tm* localtime(const time_t* timer);
41 size_t strftime(char* restrict s, size_t maxsize, const char* restrict format,
42 const tm* restrict timeptr);
43 int timespec_get( struct timespec *ts, int base); // C++17
51 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
52 #pragma GCC system_header
56 // Apple SDKs don't define ::timespec_get unconditionally in C++ mode. This
57 // should be fixed in future SDKs, but for the time being we need to avoid
58 // trying to use that declaration when the SDK doesn't provide it. Note that
59 // we're detecting this here instead of in <__config> because we can't include
60 // system headers from <__config>, since it leads to circular module dependencies.
61 // This is also meant to be a very temporary workaround until the SDKs are fixed.
62 #if defined(__APPLE__) && !__has_attribute(using_if_exists)
63 # include <sys/cdefs.h>
64 # if defined(_LIBCPP_HAS_TIMESPEC_GET) && (__DARWIN_C_LEVEL < __DARWIN_C_FULL)
65 # define _LIBCPP_HAS_TIMESPEC_GET_NOT_ACTUALLY_PROVIDED
69 _LIBCPP_BEGIN_NAMESPACE_STD
71 using ::clock_t _LIBCPP_USING_IF_EXISTS;
72 using ::size_t _LIBCPP_USING_IF_EXISTS;
73 using ::time_t _LIBCPP_USING_IF_EXISTS;
74 using ::tm _LIBCPP_USING_IF_EXISTS;
75 #if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_TIMESPEC_GET)
76 using ::timespec _LIBCPP_USING_IF_EXISTS;
78 using ::clock _LIBCPP_USING_IF_EXISTS;
79 using ::difftime _LIBCPP_USING_IF_EXISTS;
80 using ::mktime _LIBCPP_USING_IF_EXISTS;
81 using ::time _LIBCPP_USING_IF_EXISTS;
82 using ::asctime _LIBCPP_USING_IF_EXISTS;
83 using ::ctime _LIBCPP_USING_IF_EXISTS;
84 using ::gmtime _LIBCPP_USING_IF_EXISTS;
85 using ::localtime _LIBCPP_USING_IF_EXISTS;
86 using ::strftime _LIBCPP_USING_IF_EXISTS;
87 #if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_TIMESPEC_GET) && !defined(_LIBCPP_HAS_TIMESPEC_GET_NOT_ACTUALLY_PROVIDED)
88 using ::timespec_get _LIBCPP_USING_IF_EXISTS;
91 _LIBCPP_END_NAMESPACE_STD
93 #endif // _LIBCPP_CTIME