time.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. #ifndef _TIME_H
  2. #define _TIME_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #undef NULL
  7. #ifdef __cplusplus
  8. #define NULL 0
  9. #else
  10. #define NULL ((void*)0)
  11. #endif
  12. #define __NEED_time_t
  13. #define __NEED_struct_timespec
  14. #define __NEED_clock_t
  15. #define __NEED_clockid_t
  16. #define __NEED_timer_t
  17. #define __NEED_size_t
  18. #define __NEED_pid_t
  19. #include <bits/alltypes.h>
  20. struct tm
  21. {
  22. int tm_sec;
  23. int tm_min;
  24. int tm_hour;
  25. int tm_mday;
  26. int tm_mon;
  27. int tm_year;
  28. int tm_wday;
  29. int tm_yday;
  30. int tm_isdst;
  31. long __tm_gmtoff;
  32. const char *__tm_zone;
  33. };
  34. struct itimerspec
  35. {
  36. struct timespec it_interval;
  37. struct timespec it_value;
  38. };
  39. #define CLOCKS_PER_SEC 1000000UL
  40. #define CLOCK_REALTIME 0
  41. #define CLOCK_MONOTONIC 1
  42. #define CLOCK_PROCESS_CPUTIME_ID 2
  43. #define CLOCK_THREAD_CPUTIME_ID 3
  44. #define TIMER_ABSTIME 1
  45. clock_t clock (void);
  46. time_t time (time_t *);
  47. double difftime (time_t, time_t);
  48. time_t mktime (struct tm *);
  49. size_t strftime (char *, size_t, const char *, const struct tm *);
  50. char *strptime (const char *, const char *, struct tm *);
  51. struct tm *gmtime (const time_t *);
  52. struct tm *gmtime_r (const time_t *, struct tm *);
  53. struct tm *localtime (const time_t *);
  54. struct tm *localtime_r (const time_t *, struct tm *);
  55. char *asctime (const struct tm *);
  56. char *asctime_r (const struct tm *, char *);
  57. char *ctime (const time_t *);
  58. char *ctime_r (const time_t *, char *);
  59. extern int daylight;
  60. extern long timezone;
  61. extern char *tzname[2];
  62. void tzset (void);
  63. int nanosleep (const struct timespec *, struct timespec *);
  64. int clock_getres (clockid_t, struct timespec *);
  65. int clock_gettime (clockid_t, struct timespec *);
  66. int clock_settime (clockid_t, const struct timespec *);
  67. int clock_nanosleep (clockid_t, int, const struct timespec *, struct timespec *);
  68. int clock_getcpuclockid (pid_t, clockid_t *);
  69. /* FIXME */
  70. struct sigevent;
  71. int timer_create (clockid_t, struct sigevent *, timer_t *);
  72. int timer_delete (timer_t);
  73. int timer_settime (timer_t, int, const struct itimerspec *, struct itimerspec *);
  74. int timer_gettime (timer_t, struct itimerspec *);
  75. int timer_getoverrun (timer_t);
  76. extern int getdate_err;
  77. extern struct tm *getdate (const char *);
  78. #ifdef __cplusplus
  79. }
  80. #endif
  81. #endif