ctime 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. #ifndef _LIBCPP_CTIME
  10. #define _LIBCPP_CTIME
  11. /*
  12. ctime synopsis
  13. Macros:
  14. NULL
  15. CLOCKS_PER_SEC
  16. TIME_UTC // C++17
  17. namespace std
  18. {
  19. Types:
  20. clock_t
  21. size_t
  22. time_t
  23. tm
  24. timespec // C++17
  25. clock_t clock();
  26. double difftime(time_t time1, time_t time0);
  27. time_t mktime(tm* timeptr);
  28. time_t time(time_t* timer);
  29. char* asctime(const tm* timeptr);
  30. char* ctime(const time_t* timer);
  31. tm* gmtime(const time_t* timer);
  32. tm* localtime(const time_t* timer);
  33. size_t strftime(char* restrict s, size_t maxsize, const char* restrict format,
  34. const tm* restrict timeptr);
  35. int timespec_get( struct timespec *ts, int base); // C++17
  36. } // std
  37. */
  38. #include <__assert> // all public C++ headers provide the assertion handler
  39. #include <__config>
  40. #include <time.h>
  41. #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
  42. # pragma GCC system_header
  43. #endif
  44. _LIBCPP_BEGIN_NAMESPACE_STD
  45. using ::clock_t _LIBCPP_USING_IF_EXISTS;
  46. using ::size_t _LIBCPP_USING_IF_EXISTS;
  47. using ::time_t _LIBCPP_USING_IF_EXISTS;
  48. using ::tm _LIBCPP_USING_IF_EXISTS;
  49. #if _LIBCPP_STD_VER > 14 && __has_attribute(using_if_exists)
  50. using ::timespec _LIBCPP_USING_IF_EXISTS;
  51. #endif
  52. using ::clock _LIBCPP_USING_IF_EXISTS;
  53. using ::difftime _LIBCPP_USING_IF_EXISTS;
  54. using ::mktime _LIBCPP_USING_IF_EXISTS;
  55. using ::time _LIBCPP_USING_IF_EXISTS;
  56. using ::asctime _LIBCPP_USING_IF_EXISTS;
  57. using ::ctime _LIBCPP_USING_IF_EXISTS;
  58. using ::gmtime _LIBCPP_USING_IF_EXISTS;
  59. using ::localtime _LIBCPP_USING_IF_EXISTS;
  60. using ::strftime _LIBCPP_USING_IF_EXISTS;
  61. #if _LIBCPP_STD_VER > 14 && __has_attribute(using_if_exists)
  62. using ::timespec_get _LIBCPP_USING_IF_EXISTS;
  63. #endif
  64. _LIBCPP_END_NAMESPACE_STD
  65. #endif // _LIBCPP_CTIME