Changes in uspace/lib/posix/include/posix/time.h [baeeee2:fdf97f6] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/posix/include/posix/time.h
rbaeeee2 rfdf97f6 37 37 #define POSIX_TIME_H_ 38 38 39 #ifndef __POSIX_DEF__ 40 #define __POSIX_DEF__(x) x 41 #endif 42 39 43 #include "sys/types.h" 40 44 … … 49 53 #ifndef __locale_t_defined 50 54 #define __locale_t_defined 51 typedef struct __posix_locale * posix_locale_t;55 typedef struct __posix_locale *__POSIX_DEF__(locale_t); 52 56 #ifndef LIBPOSIX_INTERNAL 53 #define locale_t posix_locale_t57 #define locale_t __POSIX_DEF__(locale_t) 54 58 #endif 55 59 #endif 56 60 57 61 #ifndef POSIX_SIGNAL_H_ 58 struct posix_sigevent;62 struct __POSIX_DEF__(sigevent); 59 63 #ifndef LIBPOSIX_INTERNAL 60 #define sigevent posix_sigevent64 #define sigevent __POSIX_DEF__(sigevent) 61 65 #endif 62 66 #endif 63 67 64 #undef ASCTIME_BUF_LEN65 #define ASCTIME_BUF_LEN 2668 #undef CLOCK_REALTIME 69 #define CLOCK_REALTIME ((__POSIX_DEF__(clockid_t)) 0) 66 70 67 #undef CLOCK_REALTIME 68 #define CLOCK_REALTIME ((posix_clockid_t) 0) 69 70 struct posix_tm { 71 int tm_sec; /* Seconds [0,60]. */ 72 int tm_min; /* Minutes [0,59]. */ 73 int tm_hour; /* Hour [0,23]. */ 74 int tm_mday; /* Day of month [1,31]. */ 75 int tm_mon; /* Month of year [0,11]. */ 76 int tm_year; /* Years since 1900. */ 77 int tm_wday; /* Day of week [0,6] (Sunday = 0). */ 78 int tm_yday; /* Day of year [0,365]. */ 79 int tm_isdst; /* Daylight Savings flag. */ 80 }; 81 82 struct posix_timespec { 71 struct __POSIX_DEF__(timespec) { 83 72 time_t tv_sec; /* Seconds. */ 84 73 long tv_nsec; /* Nanoseconds. */ 85 74 }; 86 75 87 struct posix_itimerspec{88 struct posix_timespecit_interval; /* Timer period. */89 struct posix_timespecit_value; /* Timer expiration. */76 struct __POSIX_DEF__(itimerspec) { 77 struct __POSIX_DEF__(timespec) it_interval; /* Timer period. */ 78 struct __POSIX_DEF__(timespec) it_value; /* Timer expiration. */ 90 79 }; 91 80 92 typedef struct __posix_timer * posix_timer_t;81 typedef struct __posix_timer *__POSIX_DEF__(timer_t); 93 82 94 83 /* Timezones */ 95 extern int posix_daylight; 96 extern long posix_timezone; 97 extern char *posix_tzname[2]; 98 extern void posix_tzset(void); 99 100 /* Elapsed Time */ 101 extern double posix_difftime(time_t time1, time_t time0); 84 extern int __POSIX_DEF__(daylight); 85 extern long __POSIX_DEF__(timezone); 86 extern char *__POSIX_DEF__(tzname)[2]; 87 extern void __POSIX_DEF__(tzset)(void); 102 88 103 89 /* Broken-down Time */ 104 extern time_t posix_mktime(struct posix_tm *tm); 105 extern struct posix_tm *posix_gmtime(const time_t *timer); 106 extern struct posix_tm *posix_gmtime_r(const time_t *restrict timer, 107 struct posix_tm *restrict result); 108 extern struct posix_tm *posix_localtime(const time_t *timer); 109 extern struct posix_tm *posix_localtime_r(const time_t *restrict timer, 110 struct posix_tm *restrict result); 90 extern struct tm *__POSIX_DEF__(gmtime_r)(const time_t *restrict timer, 91 struct tm *restrict result); 92 extern struct tm *__POSIX_DEF__(gmtime)(const time_t *restrict timep); 93 extern struct tm *__POSIX_DEF__(localtime_r)(const time_t *restrict timer, 94 struct tm *restrict result); 95 extern struct tm *__POSIX_DEF__(localtime)(const time_t *restrict timep); 111 96 112 97 /* Formatting Calendar Time */ 113 extern char *posix_asctime(const struct posix_tm *timeptr); 114 extern char *posix_asctime_r(const struct posix_tm *restrict timeptr, 98 extern char *__POSIX_DEF__(asctime_r)(const struct tm *restrict timeptr, 115 99 char *restrict buf); 116 extern char *posix_ctime(const time_t *timer); 117 extern char *posix_ctime_r(const time_t *timer, char *buf); 118 extern size_t posix_strftime(char *restrict s, size_t maxsize, 119 const char *restrict format, const struct posix_tm *restrict tm); 100 extern char *__POSIX_DEF__(asctime)(const struct tm *restrict timeptr); 101 extern char *__POSIX_DEF__(ctime_r)(const time_t *timer, char *buf); 102 extern char *__POSIX_DEF__(ctime)(const time_t *timer); 120 103 121 104 /* Clocks */ 122 extern int posix_clock_getres(posix_clockid_tclock_id,123 struct posix_timespec*res);124 extern int posix_clock_gettime(posix_clockid_tclock_id,125 struct posix_timespec*tp);126 extern int posix_clock_settime(posix_clockid_tclock_id,127 const struct posix_timespec*tp);128 extern int posix_clock_nanosleep(posix_clockid_tclock_id, int flags,129 const struct posix_timespec *rqtp, struct posix_timespec*rmtp);105 extern int __POSIX_DEF__(clock_getres)(__POSIX_DEF__(clockid_t) clock_id, 106 struct __POSIX_DEF__(timespec) *res); 107 extern int __POSIX_DEF__(clock_gettime)(__POSIX_DEF__(clockid_t) clock_id, 108 struct __POSIX_DEF__(timespec) *tp); 109 extern int __POSIX_DEF__(clock_settime)(__POSIX_DEF__(clockid_t) clock_id, 110 const struct __POSIX_DEF__(timespec) *tp); 111 extern int __POSIX_DEF__(clock_nanosleep)(__POSIX_DEF__(clockid_t) clock_id, int flags, 112 const struct __POSIX_DEF__(timespec) *rqtp, struct __POSIX_DEF__(timespec) *rmtp); 130 113 131 114 /* CPU Time */ 132 extern posix_clock_t posix_clock(void);115 extern __POSIX_DEF__(clock_t) __POSIX_DEF__(clock)(void); 133 116 134 #ifndef LIBPOSIX_INTERNAL135 #define tm posix_tm136 #define timespec posix_timespec137 #define itimerspec posix_itimerspec138 #define timer_t posix_timer_t139 140 #define daylight posix_daylight141 #define timezone posix_timezone142 #define tzname posix_tzname143 #define tzset posix_tzset144 145 #define difftime posix_difftime146 147 #define mktime posix_mktime148 #define gmtime posix_gmtime149 #define gmtime_r posix_gmtime_r150 #define localtime posix_localtime151 #define localtime_r posix_localtime_r152 153 #define asctime posix_asctime154 #define asctime_r posix_asctime_r155 #define ctime posix_ctime156 #define ctime_r posix_ctime_r157 #define strftime posix_strftime158 159 #define clock_getres posix_clock_getres160 #define clock_gettime posix_clock_gettime161 #define clock_settime posix_clock_settime162 #define clock_nanosleep posix_clock_nanosleep163 164 #define clock posix_clock165 #endif166 117 167 118 #endif // POSIX_TIME_H_
Note:
See TracChangeset
for help on using the changeset viewer.