1 #ifndef _TIME_H 2 #define _TIME_H 3 4 #ifndef _TIME_T 5 #define _TIME_T 6 typedef long time_t; 7 #endif 8 9 #ifndef _SIZE_T 10 #define _SIZE_T 11 typedef unsigned int size_t; 12 #endif 13 14 #ifndef NULL 15 #define NULL ((void *) 0) 16 #endif 17 18 #define CLOCKS_PER_SEC 100 19 20 #ifndef _CLOCK_T 21 #define _CLOCK_T 22 typedef long clock_t; 23 #endif 24 25 struct tm { 26 int tm_sec; 27 int tm_min; 28 int tm_hour; 29 int tm_mday; 30 int tm_mon; 31 int tm_year; 32 int tm_wday; 33 int tm_yday; 34 int tm_isdst; 35 }; 36 37 #define __isleap(year) \ 38 ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0)) 39 40 #ifdef __cplusplus 41 extern "C" { 42 #endif 43 44 clock_t clock(void); 45 time_t time(time_t * tp); 46 double difftime(time_t time2, time_t time1); 47 time_t mktime(struct tm * tp); 48 49 char * asctime(const struct tm * tp); 50 char * ctime(const time_t * tp); 51 struct tm * gmtime(const time_t *tp); 52 struct tm *localtime(const time_t * tp); 53 size_t strftime(char * s, size_t smax, const char * fmt, const struct tm * tp); 54 void tzset(void); 55 56 #ifdef __cplusplus 57 } 58 #endif 59 60 #endif