time.h (1168B)
1 #ifndef _TIME_H 2 #define _TIME_H 3 4 #include <sys/types.h> 5 6 7 struct tm { 8 int tm_sec; 9 int tm_min; 10 int tm_hour; 11 int tm_mday; 12 int tm_mon; 13 int tm_year; 14 int tm_wday; 15 int tm_yday; 16 int tm_isdst; 17 }; 18 19 20 // Time conversion 21 char *asctime(const struct tm *); 22 char *asctime_r(const struct tm *__restrict, char *__restrict); 23 24 char *ctime(const time_t *); 25 char *ctime_r(const time_t *, char *); 26 27 // Time conversion using format string 28 size_t strftime(char *__restrict s, size_t maxsize, 29 const char *__restrict format, const struct tm *__restrict timeptr); 30 char *strptime(const char *__restrict buf, const char *__restrict format, 31 struct tm *__restrict tm); 32 33 // Time arithmetic 34 double difftime(time_t, time_t); 35 36 // Time breakdown into struct tm 37 struct tm *gmtime(const time_t *); 38 struct tm *gmtime_r(const time_t *__restrict, struct tm *__restrict); 39 struct tm *localtime(const time_t *); 40 struct tm *localtime_r(const time_t *__restrict, struct tm *__restrict); 41 time_t mktime(const struct tm *); 42 43 // Current wall-clock time 44 time_t time(time_t*); 45 46 #define CLOCKS_PER_SEC 128 47 // Current virtual CPU usage counter 48 clock_t clock(void); 49 50 #endif // _TIME_H