time.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * time.h - date and time
  3. */
  4. /* $Id$ */
  5. #ifndef _TIME_H
  6. #define _TIME_H
  7. #include <stddef.h>
  8. #define CLOCKS_PER_SEC 1000000
  9. typedef unsigned long time_t; /* type returned by TOD clock */
  10. typedef unsigned long clock_t; /* type returned by real time clock */
  11. struct tm {
  12. int tm_sec; /* seconds after the minute - [0, 59] */
  13. int tm_min; /* minutes after the hour - [0, 59] */
  14. int tm_hour; /* hours since midnight - [0, 23] */
  15. int tm_mday; /* day of the month - [1, 31] */
  16. int tm_mon; /* months since January - [0, 11] */
  17. int tm_year; /* years since 1900 */
  18. int tm_wday; /* days since Sunday - [0, 6] */
  19. int tm_yday; /* days since January 1 - [0, 365] */
  20. int tm_isdst; /* Daylight Saving Time flag */
  21. };
  22. extern clock_t clock(void);
  23. extern double difftime(time_t _time1, time_t _time0);
  24. extern time_t mktime(struct tm *_timeptr);
  25. extern time_t time(time_t *_timeptr);
  26. extern char* asctime(const struct tm *_timeptr);
  27. extern char* ctime(const time_t *_timer);
  28. extern struct tm* gmtime(const time_t *_timer);
  29. extern struct tm* localtime(const time_t *_timer);
  30. extern size_t strftime(char *_s, size_t _maxsize,
  31. const char *_format,
  32. const struct tm *_timeptr);
  33. /* Extensions not in the standard */
  34. #define ctime(t) asctime(localtime(t))
  35. #endif