blob: 6c5b0166f9e4270dda17e72ae237e31935c4d0dd [file] [log] [blame]
Howard Hinnant3e519522010-05-11 19:42:161// -*- C++ -*-
Louis Dionneeb8650a2021-11-17 21:25:012//===----------------------------------------------------------------------===//
Howard Hinnant3e519522010-05-11 19:42:163//
Chandler Carruth57b08b02019-01-19 10:56:404// 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
Howard Hinnant3e519522010-05-11 19:42:167//
8//===----------------------------------------------------------------------===//
9
10#ifndef _LIBCPP_CTIME
11#define _LIBCPP_CTIME
12
13/*
14 ctime synopsis
15
16Macros:
17
18 NULL
19 CLOCKS_PER_SEC
Marshall Clowdeb471f2018-07-31 19:25:0020 TIME_UTC // C++17
Louis Dionne6b77ebd2019-10-23 17:40:1521
Howard Hinnant3e519522010-05-11 19:42:1622namespace std
23{
24
25Types:
26
27 clock_t
28 size_t
29 time_t
30 tm
Marshall Clowdeb471f2018-07-31 19:25:0031 timespec // C++17
Louis Dionne6b77ebd2019-10-23 17:40:1532
Howard Hinnant3e519522010-05-11 19:42:1633clock_t clock();
34double difftime(time_t time1, time_t time0);
35time_t mktime(tm* timeptr);
36time_t time(time_t* timer);
37char* asctime(const tm* timeptr);
38char* ctime(const time_t* timer);
39tm* gmtime(const time_t* timer);
40tm* localtime(const time_t* timer);
41size_t strftime(char* restrict s, size_t maxsize, const char* restrict format,
42 const tm* restrict timeptr);
Marshall Clowdeb471f2018-07-31 19:25:0043int timespec_get( struct timespec *ts, int base); // C++17
Howard Hinnant3e519522010-05-11 19:42:1644} // std
45
46*/
47
Nikolas Klauserc166a9c2024-12-10 15:02:1248#if 0
49#else // 0
50# include <__config>
51# include <__cstddef/size_t.h>
Louis Dionne647ddc02022-11-22 18:42:3352
53// <time.h> is not provided by libc++
Nikolas Klauserc166a9c2024-12-10 15:02:1254# if __has_include(<time.h>)
55# include <time.h>
56# ifdef _LIBCPP_TIME_H
57# error "If libc++ starts defining <time.h>, the __has_include check should move to libc++'s <time.h>"
58# endif
Louis Dionne647ddc02022-11-22 18:42:3359# endif
Howard Hinnant3e519522010-05-11 19:42:1660
Nikolas Klauserc166a9c2024-12-10 15:02:1261# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
62# pragma GCC system_header
63# endif
Howard Hinnant3e519522010-05-11 19:42:1664
Howard Hinnant3e519522010-05-11 19:42:1665_LIBCPP_BEGIN_NAMESPACE_STD
66
Louis Dionnea9c91832021-06-02 14:41:3767using ::clock_t _LIBCPP_USING_IF_EXISTS;
Louis Dionnea9c91832021-06-02 14:41:3768using ::time_t _LIBCPP_USING_IF_EXISTS;
69using ::tm _LIBCPP_USING_IF_EXISTS;
Nikolas Klauserc166a9c2024-12-10 15:02:1270# if _LIBCPP_STD_VER >= 17
Louis Dionnea9c91832021-06-02 14:41:3771using ::timespec _LIBCPP_USING_IF_EXISTS;
Nikolas Klauserc166a9c2024-12-10 15:02:1272# endif
Louis Dionnea9c91832021-06-02 14:41:3773using ::clock _LIBCPP_USING_IF_EXISTS;
74using ::difftime _LIBCPP_USING_IF_EXISTS;
75using ::mktime _LIBCPP_USING_IF_EXISTS;
76using ::time _LIBCPP_USING_IF_EXISTS;
Louis Dionnea9c91832021-06-02 14:41:3777using ::asctime _LIBCPP_USING_IF_EXISTS;
78using ::ctime _LIBCPP_USING_IF_EXISTS;
79using ::gmtime _LIBCPP_USING_IF_EXISTS;
80using ::localtime _LIBCPP_USING_IF_EXISTS;
Louis Dionnea9c91832021-06-02 14:41:3781using ::strftime _LIBCPP_USING_IF_EXISTS;
Nikolas Klauserc166a9c2024-12-10 15:02:1282# if _LIBCPP_STD_VER >= 17
Louis Dionnea9c91832021-06-02 14:41:3783using ::timespec_get _LIBCPP_USING_IF_EXISTS;
Nikolas Klauserc166a9c2024-12-10 15:02:1284# endif
Howard Hinnant3e519522010-05-11 19:42:1685
86_LIBCPP_END_NAMESPACE_STD
87
Nikolas Klauserc166a9c2024-12-10 15:02:1288#endif // 0
89
Louis Dionne4cd6ca12021-04-20 16:03:3290#endif // _LIBCPP_CTIME