Changes in uspace/lib/posix/time.h [3f466c33:823a929] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/posix/time.h
r3f466c33 r823a929 38 38 39 39 #include "libc/time.h" 40 #include "sys/types.h"41 40 42 41 #ifndef NULL 43 42 #define NULL ((void *) 0) 44 43 #endif 45 46 #ifndef CLOCKS_PER_SEC47 #define CLOCKS_PER_SEC (1000000L)48 #endif49 50 #ifndef __locale_t_defined51 #define __locale_t_defined52 typedef struct __posix_locale *posix_locale_t;53 #ifndef LIBPOSIX_INTERNAL54 #define locale_t posix_locale_t55 #endif56 #endif57 58 #ifndef POSIX_SIGNAL_H_59 struct posix_sigevent;60 #ifndef LIBPOSIX_INTERNAL61 #define sigevent posix_sigevent62 #endif63 #endif64 65 #undef ASCTIME_BUF_LEN66 #define ASCTIME_BUF_LEN 2667 68 #undef CLOCK_REALTIME69 #define CLOCK_REALTIME ((posix_clockid_t) 0)70 44 71 45 struct posix_tm { … … 81 55 }; 82 56 83 struct posix_timespec { 84 time_t tv_sec; /* Seconds. */ 85 long tv_nsec; /* Nanoseconds. */ 86 }; 87 88 struct posix_itimerspec { 89 struct posix_timespec it_interval; /* Timer period. */ 90 struct posix_timespec it_value; /* Timer expiration. */ 91 }; 92 93 typedef struct __posix_timer *posix_timer_t; 94 95 /* Timezones */ 96 97 extern int posix_daylight; 98 extern long posix_timezone; 99 extern char *posix_tzname[2]; 100 101 extern void posix_tzset(void); 102 103 /* time_t */ 104 105 extern double posix_difftime(time_t time1, time_t time0); 57 typedef long posix_clock_t; 106 58 107 59 /* Broken-down Time */ 108 extern time_t posix_mktime(struct posix_tm *timeptr); 109 extern struct posix_tm *posix_gmtime(const time_t *timer); 110 extern struct posix_tm *posix_gmtime_r(const time_t *restrict timer, 111 struct posix_tm *restrict result); 112 extern struct posix_tm *posix_localtime(const time_t *timer); 113 extern struct posix_tm *posix_localtime_r(const time_t *restrict timer, 114 struct posix_tm *restrict result); 60 extern struct posix_tm *posix_localtime(const time_t *timep); 115 61 116 62 /* Formatting Calendar Time */ 117 extern char *posix_asctime(const struct posix_tm *timeptr); 118 extern char *posix_asctime_r(const struct posix_tm *restrict timeptr, 119 char *restrict buf); 120 extern char *posix_ctime(const time_t *timer); 121 extern char *posix_ctime_r(const time_t *timer, char *buf); 122 123 extern size_t posix_strftime(char *restrict s, size_t maxsize, 124 const char *restrict format, const struct posix_tm *restrict tm); 125 126 extern size_t posix_strftime_l(char *restrict s, size_t maxsize, 127 const char *restrict format, const struct posix_tm *restrict tm, 128 posix_locale_t loc); 129 130 /* Clocks. */ 131 132 extern int posix_clock_getres(posix_clockid_t clock_id, 133 struct posix_timespec *res); 134 extern int posix_clock_gettime(posix_clockid_t clock_id, 135 struct posix_timespec *tp); 136 extern int posix_clock_settime(posix_clockid_t clock_id, 137 const struct posix_timespec *tp); 138 extern int posix_clock_nanosleep(posix_clockid_t clock_id, int flags, 139 const struct posix_timespec *rqtp, struct posix_timespec *rmtp); 140 141 /* Timers. */ 142 143 #if 0 144 145 extern int posix_timer_create(posix_clockid_t clockid, 146 struct posix_sigevent *restrict evp, 147 posix_timer_t *restrict timerid); 148 extern int posix_timer_delete(posix_timer_t timerid); 149 extern int posix_timer_getoverrun(posix_timer_t timerid); 150 extern int posix_timer_gettime(posix_timer_t timerid, 151 struct posix_itimerspec *value); 152 extern int posix_timer_settime(posix_timer_t timerid, int flags, 153 const struct posix_itimerspec *restrict value, 154 struct posix_itimerspec *restrict ovalue); 155 156 #endif 63 extern char *posix_asctime(const struct posix_tm *tm); 64 extern char *posix_ctime(const time_t *timep); 65 extern size_t posix_strftime(char *restrict s, size_t maxsize, const char *restrict format, const struct posix_tm *restrict tm); 157 66 158 67 /* CPU Time */ 159 68 extern posix_clock_t posix_clock(void); 160 69 161 162 70 #ifndef LIBPOSIX_INTERNAL 163 71 #define tm posix_tm 164 72 165 #define timespec posix_timespec 166 #define itimerspec posix_itimerspec 167 #define timer_t posix_timer_t 73 #define clock_t posix_clock_t 168 74 169 #define difftime posix_difftime170 #define mktime posix_mktime171 #define gmtime posix_gmtime172 #define gmtime_r posix_gmtime_r173 75 #define localtime posix_localtime 174 #define localtime_r posix_localtime_r175 176 #define daylight posix_daylight177 #define timezone posix_timezone178 #define tzname posix_tzname179 #define tzset posix_tzset180 76 181 77 #define asctime posix_asctime 182 #define asctime_r posix_asctime_r183 78 #define ctime posix_ctime 184 #define ctime_r posix_ctime_r185 79 #define strftime posix_strftime 186 80 187 #define clock_getres posix_clock_getres188 #define clock_gettime posix_clock_gettime189 #define clock_settime posix_clock_settime190 #define clock_nanosleep posix_clock_nanosleep191 192 #define timer_create posix_timer_create193 #define timer_delete posix_timer_delete194 #define timer_getoverrun posix_timer_getoverrun195 #define timer_gettime posix_timer_gettime196 #define timer_settime posix_timer_settime197 198 81 #define clock posix_clock 199 82 #endif
Note:
See TracChangeset
for help on using the changeset viewer.