time.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. #ifndef __TIME_H
  10. #define __TIME_H
  11. #pragma lib "/$M/lib/ape/libap.a"
  12. #include <stddef.h>
  13. #define CLOCKS_PER_SEC 1000
  14. /* obsolsecent, but required */
  15. #define CLK_TCK CLOCKS_PER_SEC
  16. #ifndef _CLOCK_T
  17. #define _CLOCK_T
  18. typedef int32_t clock_t;
  19. #endif
  20. #ifndef _TIME_T
  21. #define _TIME_T
  22. typedef int32_t time_t;
  23. #endif
  24. struct tm {
  25. int tm_sec;
  26. int tm_min;
  27. int tm_hour;
  28. int tm_mday;
  29. int tm_mon;
  30. int tm_year;
  31. int tm_wday;
  32. int tm_yday;
  33. int tm_isdst;
  34. };
  35. #ifdef __cplusplus
  36. extern "C" {
  37. #endif
  38. extern clock_t clock(void);
  39. extern double difftime(time_t, time_t);
  40. extern time_t mktime(struct tm *);
  41. extern time_t time(time_t *);
  42. extern char *asctime(const struct tm *);
  43. extern char *ctime(const time_t *);
  44. extern struct tm *gmtime(const time_t *);
  45. extern struct tm *localtime(const time_t *);
  46. extern size_t strftime(char *, size_t, const char *, const struct tm *);
  47. #ifdef _REENTRANT_SOURCE
  48. extern struct tm *gmtime_r(const time_t *, struct tm *);
  49. extern struct tm *localtime_r(const time_t *, struct tm *);
  50. extern char *ctime_r(const time_t *, char *);
  51. #endif
  52. #ifdef _POSIX_SOURCE
  53. extern void tzset(void);
  54. #endif
  55. #ifdef __cplusplus
  56. }
  57. #endif
  58. #ifdef _POSIX_SOURCE
  59. extern char *tzname[2];
  60. #endif
  61. #endif /* __TIME_H */