xref: /freebsd/contrib/llvm-project/libcxx/include/ctime (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
1// -*- C++ -*-
2//===----------------------------------------------------------------------===//
3//
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
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef _LIBCPP_CTIME
11#define _LIBCPP_CTIME
12
13/*
14    ctime synopsis
15
16Macros:
17
18    NULL
19    CLOCKS_PER_SEC
20    TIME_UTC // C++17
21
22namespace std
23{
24
25Types:
26
27    clock_t
28    size_t
29    time_t
30    tm
31    timespec // C++17
32
33clock_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);
43int timespec_get( struct timespec *ts, int base); // C++17
44}  // std
45
46*/
47
48#include <__config>
49
50// <time.h> is not provided by libc++
51#if __has_include(<time.h>)
52#  include <time.h>
53#  ifdef _LIBCPP_TIME_H
54#    error "If libc++ starts defining <time.h>, the __has_include check should move to libc++'s <time.h>"
55#  endif
56#endif
57
58#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
59#  pragma GCC system_header
60#endif
61
62_LIBCPP_BEGIN_NAMESPACE_STD
63
64using ::clock_t _LIBCPP_USING_IF_EXISTS;
65using ::size_t _LIBCPP_USING_IF_EXISTS;
66using ::time_t _LIBCPP_USING_IF_EXISTS;
67using ::tm _LIBCPP_USING_IF_EXISTS;
68#if _LIBCPP_STD_VER >= 17
69using ::timespec _LIBCPP_USING_IF_EXISTS;
70#endif
71using ::clock _LIBCPP_USING_IF_EXISTS;
72using ::difftime _LIBCPP_USING_IF_EXISTS;
73using ::mktime _LIBCPP_USING_IF_EXISTS;
74using ::time _LIBCPP_USING_IF_EXISTS;
75using ::asctime _LIBCPP_USING_IF_EXISTS;
76using ::ctime _LIBCPP_USING_IF_EXISTS;
77using ::gmtime _LIBCPP_USING_IF_EXISTS;
78using ::localtime _LIBCPP_USING_IF_EXISTS;
79using ::strftime _LIBCPP_USING_IF_EXISTS;
80#if _LIBCPP_STD_VER >= 17
81using ::timespec_get _LIBCPP_USING_IF_EXISTS;
82#endif
83
84_LIBCPP_END_NAMESPACE_STD
85
86#endif // _LIBCPP_CTIME
87