1
0

time.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. #ifndef _TIME_H
  2. #define _TIME_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #include <features.h>
  7. #define NULL 0L
  8. #define __NEED_size_t
  9. #define __NEED_time_t
  10. #define __NEED_clock_t
  11. #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
  12. || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
  13. || defined(_BSD_SOURCE)
  14. #define __NEED_struct_timespec
  15. #define __NEED_clockid_t
  16. #define __NEED_timer_t
  17. #define __NEED_pid_t
  18. #define __NEED_locale_t
  19. #endif
  20. #include <bits/alltypes.h>
  21. #if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
  22. #define __tm_gmtoff tm_gmtoff
  23. #define __tm_zone tm_zone
  24. #endif
  25. struct tm
  26. {
  27. int tm_sec;
  28. int tm_min;
  29. int tm_hour;
  30. int tm_mday;
  31. int tm_mon;
  32. int tm_year;
  33. int tm_wday;
  34. int tm_yday;
  35. int tm_isdst;
  36. long __tm_gmtoff;
  37. const char *__tm_zone;
  38. };
  39. clock_t clock (void);
  40. time_t time (time_t *);
  41. double difftime (time_t, time_t);
  42. time_t mktime (struct tm *);
  43. size_t strftime (char *__restrict, size_t, const char *__restrict, const struct tm *__restrict);
  44. struct tm *gmtime (const time_t *);
  45. struct tm *localtime (const time_t *);
  46. char *asctime (const struct tm *);
  47. char *ctime (const time_t *);
  48. #define CLOCKS_PER_SEC 1000000L
  49. #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
  50. || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
  51. || defined(_BSD_SOURCE)
  52. size_t strftime_l (char * __restrict, size_t, const char * __restrict, const struct tm * __restrict, locale_t);
  53. struct tm *gmtime_r (const time_t *__restrict, struct tm *__restrict);
  54. struct tm *localtime_r (const time_t *__restrict, struct tm *__restrict);
  55. char *asctime_r (const struct tm *__restrict, char *__restrict);
  56. char *ctime_r (const time_t *, char *);
  57. void tzset (void);
  58. struct itimerspec
  59. {
  60. struct timespec it_interval;
  61. struct timespec it_value;
  62. };
  63. #define CLOCK_REALTIME 0
  64. #define CLOCK_MONOTONIC 1
  65. #define CLOCK_PROCESS_CPUTIME_ID 2
  66. #define CLOCK_THREAD_CPUTIME_ID 3
  67. #define CLOCK_MONOTONIC_RAW 4
  68. #define CLOCK_REALTIME_COURSE 5
  69. #define CLOCK_MONOTONIC_COURSE 6
  70. #define CLOCK_BOOTTIME 7
  71. #define CLOCK_REALTIME_ALARM 8
  72. #define CLOCK_BOOTTIME_ALARM 9
  73. #define CLOCK_SGI_CYCLE 10
  74. #define CLOCK_TAI 11
  75. #define TIMER_ABSTIME 1
  76. int nanosleep (const struct timespec *, struct timespec *);
  77. int clock_getres (clockid_t, struct timespec *);
  78. int clock_gettime (clockid_t, struct timespec *);
  79. int clock_settime (clockid_t, const struct timespec *);
  80. int clock_nanosleep (clockid_t, int, const struct timespec *, struct timespec *);
  81. int clock_getcpuclockid (pid_t, clockid_t *);
  82. struct sigevent;
  83. int timer_create (clockid_t, struct sigevent *__restrict, timer_t *__restrict);
  84. int timer_delete (timer_t);
  85. int timer_settime (timer_t, int, const struct itimerspec *__restrict, struct itimerspec *__restrict);
  86. int timer_gettime (timer_t, struct itimerspec *);
  87. int timer_getoverrun (timer_t);
  88. #endif
  89. #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
  90. char *strptime (const char *__restrict, const char *__restrict, struct tm *__restrict);
  91. extern int daylight;
  92. extern long timezone;
  93. extern char *tzname[2];
  94. extern int getdate_err;
  95. struct tm *getdate (const char *);
  96. #endif
  97. #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  98. int stime(time_t *);
  99. time_t timegm(struct tm *);
  100. #endif
  101. #ifdef __cplusplus
  102. }
  103. #endif
  104. #endif