time.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* The <time.h> header is used by the procedures that deal with time.
  2. * Handling time is surprisingly complicated, what with GMT, local time
  3. * and other factors. Although the Bishop of Ussher (1581-1656) once
  4. * calculated that based on the Bible, the world began on 12 Oct. 4004 BC
  5. * at 9 o'clock in the morning, in the UNIX world time begins at midnight,
  6. * 1 Jan. 1970 GMT. Before that, all was NULL and (void).
  7. */
  8. #ifndef _TIME_H
  9. #define _TIME_H
  10. #define CLOCKS_PER_SEC 60 /* MINIX always uses 60 Hz, even in Europe */
  11. #ifdef _POSIX_SOURCE
  12. #define CLK_TCK CLOCKS_PER_SEC
  13. #endif
  14. #define NULL ((void *)0)
  15. #ifndef _SIZE_T
  16. #define _SIZE_T
  17. typedef unsigned int size_t; /* type returned by sizeof */
  18. #endif
  19. #ifndef _TIME_T
  20. #define _TIME_T
  21. typedef long time_t; /* time in sec since 1 Jan 1970 0000 GMT */
  22. #endif
  23. #ifndef _CLOCK_T
  24. #define _CLOCK_T
  25. typedef long clock_t; /* time in ticks since process started */
  26. #endif
  27. struct tm {
  28. int tm_sec; /* seconds after the minute [0, 59] */
  29. int tm_min; /* minutes after the hour [0, 59] */
  30. int tm_hour; /* hours since midnight [0, 23] */
  31. int tm_mday; /* day of the month [1, 31] */
  32. int tm_mon; /* months since January [0, 11] */
  33. int tm_year; /* years since 1900 */
  34. int tm_wday; /* days since Sunday [0, 6] */
  35. int tm_yday; /* days since January 1 [0, 365] */
  36. int tm_isdst; /* Daylight Saving Time flag */
  37. };
  38. /* Function Prototypes. */
  39. #ifndef _ANSI_H
  40. #include <ansi.h>
  41. #endif
  42. _PROTOTYPE( clock_t clock, (void) );
  43. _PROTOTYPE( double difftime, (time_t _time1, time_t _time0) );
  44. _PROTOTYPE( time_t mktime, (struct tm *_timeptr) );
  45. _PROTOTYPE( time_t time, (time_t *_timeptr) );
  46. _PROTOTYPE( char *asctime, (const struct tm *_timeptr) );
  47. _PROTOTYPE( char *ctime, (const time_t *_timer) );
  48. _PROTOTYPE( struct tm *gmtime, (const time_t *_timer) );
  49. _PROTOTYPE( struct tm *localtime, (const time_t *_timer) );
  50. _PROTOTYPE( size_t strftime, (char *_s, size_t _max, const char *_fmt,
  51. const struct tm *_timep) );
  52. #ifdef _POSIX_SOURCE
  53. _PROTOTYPE( void tzset, (void) );
  54. #endif
  55. #endif /* _TIME_H */