Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1 | // -*- C++ -*- |
| 2 | //===---------------------------- ctime -----------------------------------===// |
| 3 | // |
Howard Hinnant | c566dc3 | 2010-05-11 21:36:01 +0000 | [diff] [blame] | 4 | // The LLVM Compiler Infrastructure |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 5 | // |
Howard Hinnant | ee11c31 | 2010-11-16 22:09:02 +0000 | [diff] [blame] | 6 | // This file is dual licensed under the MIT and the University of Illinois Open |
| 7 | // Source Licenses. See LICENSE.TXT for details. |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 8 | // |
| 9 | //===----------------------------------------------------------------------===// |
| 10 | |
| 11 | #ifndef _LIBCPP_CTIME |
| 12 | #define _LIBCPP_CTIME |
| 13 | |
| 14 | /* |
| 15 | ctime synopsis |
| 16 | |
| 17 | Macros: |
| 18 | |
| 19 | NULL |
| 20 | CLOCKS_PER_SEC |
Marshall Clow | 8e632a9 | 2018-07-31 19:25:00 +0000 | [diff] [blame] | 21 | TIME_UTC // C++17 |
| 22 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 23 | namespace std |
| 24 | { |
| 25 | |
| 26 | Types: |
| 27 | |
| 28 | clock_t |
| 29 | size_t |
| 30 | time_t |
| 31 | tm |
Marshall Clow | 8e632a9 | 2018-07-31 19:25:00 +0000 | [diff] [blame] | 32 | timespec // C++17 |
| 33 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 34 | clock_t clock(); |
| 35 | double difftime(time_t time1, time_t time0); |
| 36 | time_t mktime(tm* timeptr); |
| 37 | time_t time(time_t* timer); |
| 38 | char* asctime(const tm* timeptr); |
| 39 | char* ctime(const time_t* timer); |
| 40 | tm* gmtime(const time_t* timer); |
| 41 | tm* localtime(const time_t* timer); |
| 42 | size_t strftime(char* restrict s, size_t maxsize, const char* restrict format, |
| 43 | const tm* restrict timeptr); |
Marshall Clow | 8e632a9 | 2018-07-31 19:25:00 +0000 | [diff] [blame] | 44 | int timespec_get( struct timespec *ts, int base); // C++17 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 45 | } // std |
| 46 | |
| 47 | */ |
| 48 | |
| 49 | #include <__config> |
| 50 | #include <time.h> |
| 51 | |
Howard Hinnant | aaaa52b | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 52 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 53 | #pragma GCC system_header |
Howard Hinnant | aaaa52b | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 54 | #endif |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 55 | |
| 56 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 57 | |
| 58 | using ::clock_t; |
| 59 | using ::size_t; |
| 60 | using ::time_t; |
| 61 | using ::tm; |
Marshall Clow | 8e632a9 | 2018-07-31 19:25:00 +0000 | [diff] [blame] | 62 | #if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_C11_FEATURES) |
| 63 | using ::timespec; |
| 64 | #endif |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 65 | using ::clock; |
| 66 | using ::difftime; |
| 67 | using ::mktime; |
| 68 | using ::time; |
Ed Schouten | 137c863 | 2015-06-24 08:44:38 +0000 | [diff] [blame] | 69 | #ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 70 | using ::asctime; |
| 71 | using ::ctime; |
| 72 | using ::gmtime; |
| 73 | using ::localtime; |
Ed Schouten | 137c863 | 2015-06-24 08:44:38 +0000 | [diff] [blame] | 74 | #endif |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 75 | using ::strftime; |
Marshall Clow | a6a55a8 | 2018-08-15 21:19:08 +0000 | [diff] [blame] | 76 | #if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_TIMESPEC_GET) |
Marshall Clow | 8e632a9 | 2018-07-31 19:25:00 +0000 | [diff] [blame] | 77 | using ::timespec_get; |
| 78 | #endif |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 79 | |
| 80 | _LIBCPP_END_NAMESPACE_STD |
| 81 | |
| 82 | #endif // _LIBCPP_CTIME |