| 1 | #ifndef _TIME_H |
| 2 | #include <time/time.h> |
| 3 | |
| 4 | #ifndef _ISOMAC |
| 5 | # include <bits/types/locale_t.h> |
| 6 | # include <stdbool.h> |
| 7 | # include <time/mktime-internal.h> |
| 8 | |
| 9 | extern __typeof (strftime_l) __strftime_l; |
| 10 | libc_hidden_proto (__strftime_l) |
| 11 | extern __typeof (strptime_l) __strptime_l; |
| 12 | |
| 13 | libc_hidden_proto (time) |
| 14 | libc_hidden_proto (asctime) |
| 15 | libc_hidden_proto (mktime) |
| 16 | libc_hidden_proto (timelocal) |
| 17 | libc_hidden_proto (localtime) |
| 18 | libc_hidden_proto (strftime) |
| 19 | libc_hidden_proto (strptime) |
| 20 | |
| 21 | extern __typeof (clock_getres) __clock_getres; |
| 22 | extern __typeof (clock_gettime) __clock_gettime; |
| 23 | libc_hidden_proto (__clock_gettime) |
| 24 | extern __typeof (clock_settime) __clock_settime; |
| 25 | extern __typeof (clock_nanosleep) __clock_nanosleep; |
| 26 | extern __typeof (clock_getcpuclockid) __clock_getcpuclockid; |
| 27 | |
| 28 | /* Now define the internal interfaces. */ |
| 29 | struct tm; |
| 30 | |
| 31 | /* Defined in mktime.c. */ |
| 32 | extern const unsigned short int __mon_yday[2][13] attribute_hidden; |
| 33 | |
| 34 | /* Defined in localtime.c. */ |
| 35 | extern struct tm _tmbuf attribute_hidden; |
| 36 | |
| 37 | /* Defined in tzset.c. */ |
| 38 | extern char *__tzstring (const char *string) attribute_hidden; |
| 39 | |
| 40 | extern int __use_tzfile attribute_hidden; |
| 41 | |
| 42 | extern void __tzfile_read (const char *file, size_t , |
| 43 | char **) attribute_hidden; |
| 44 | extern void __tzfile_compute (__time64_t timer, int use_localtime, |
| 45 | long int *leap_correct, int *leap_hit, |
| 46 | struct tm *tp) attribute_hidden; |
| 47 | extern void __tzfile_default (const char *std, const char *dst, |
| 48 | int stdoff, int dstoff) |
| 49 | attribute_hidden; |
| 50 | extern void __tzset_parse_tz (const char *tz) attribute_hidden; |
| 51 | extern void __tz_compute (__time64_t timer, struct tm *tm, int use_localtime) |
| 52 | __THROW attribute_hidden; |
| 53 | |
| 54 | #if __TIMESIZE == 64 |
| 55 | # define __ctime64 ctime |
| 56 | #else |
| 57 | extern char *__ctime64 (const __time64_t *__timer) __THROW; |
| 58 | libc_hidden_proto (__ctime64) |
| 59 | #endif |
| 60 | |
| 61 | #if __TIMESIZE == 64 |
| 62 | # define __ctime64_r ctime_r |
| 63 | #else |
| 64 | extern char *__ctime64_r (const __time64_t *__restrict __timer, |
| 65 | char *__restrict __buf) __THROW; |
| 66 | libc_hidden_proto (__ctime64_r) |
| 67 | #endif |
| 68 | |
| 69 | #if __TIMESIZE == 64 |
| 70 | # define __localtime64 localtime |
| 71 | #else |
| 72 | extern struct tm *__localtime64 (const __time64_t *__timer); |
| 73 | libc_hidden_proto (__localtime64) |
| 74 | #endif |
| 75 | |
| 76 | extern struct tm *__localtime_r (const time_t *__timer, |
| 77 | struct tm *__tp) attribute_hidden; |
| 78 | #if __TIMESIZE != 64 |
| 79 | extern struct tm *__localtime64_r (const __time64_t *__timer, |
| 80 | struct tm *__tp); |
| 81 | libc_hidden_proto (__localtime64_r) |
| 82 | |
| 83 | extern __time64_t __mktime64 (struct tm *__tp) __THROW; |
| 84 | libc_hidden_proto (__mktime64) |
| 85 | #endif |
| 86 | |
| 87 | extern struct tm *__gmtime_r (const time_t *__restrict __timer, |
| 88 | struct tm *__restrict __tp); |
| 89 | libc_hidden_proto (__gmtime_r) |
| 90 | |
| 91 | #if __TIMESIZE == 64 |
| 92 | # define __gmtime64 gmtime |
| 93 | #else |
| 94 | extern struct tm *__gmtime64 (const __time64_t *__timer); |
| 95 | libc_hidden_proto (__gmtime64) |
| 96 | |
| 97 | extern struct tm *__gmtime64_r (const __time64_t *__restrict __timer, |
| 98 | struct tm *__restrict __tp); |
| 99 | libc_hidden_proto (__gmtime64_r) |
| 100 | |
| 101 | extern __time64_t __timegm64 (struct tm *__tp) __THROW; |
| 102 | libc_hidden_proto (__timegm64) |
| 103 | #endif |
| 104 | |
| 105 | /* Compute the `struct tm' representation of T, |
| 106 | offset OFFSET seconds east of UTC, |
| 107 | and store year, yday, mon, mday, wday, hour, min, sec into *TP. |
| 108 | Return nonzero if successful. */ |
| 109 | extern int __offtime (__time64_t __timer, |
| 110 | long int __offset, |
| 111 | struct tm *__tp) attribute_hidden; |
| 112 | |
| 113 | extern char *__asctime_r (const struct tm *__tp, char *__buf) |
| 114 | attribute_hidden; |
| 115 | extern void __tzset (void) attribute_hidden; |
| 116 | |
| 117 | /* Prototype for the internal function to get information based on TZ. */ |
| 118 | extern struct tm *__tz_convert (__time64_t timer, int use_localtime, |
| 119 | struct tm *tp) attribute_hidden; |
| 120 | |
| 121 | extern int __nanosleep (const struct timespec *__requested_time, |
| 122 | struct timespec *__remaining); |
| 123 | hidden_proto (__nanosleep) |
| 124 | extern int __getdate_r (const char *__string, struct tm *__resbufp) |
| 125 | attribute_hidden; |
| 126 | |
| 127 | |
| 128 | /* Determine CLK_TCK value. */ |
| 129 | extern int __getclktck (void) attribute_hidden; |
| 130 | |
| 131 | |
| 132 | /* strptime support. */ |
| 133 | extern char * __strptime_internal (const char *rp, const char *fmt, |
| 134 | struct tm *tm, void *statep, |
| 135 | locale_t locparam) attribute_hidden; |
| 136 | |
| 137 | #if __TIMESIZE == 64 |
| 138 | # define __difftime64 __difftime |
| 139 | #else |
| 140 | extern double __difftime64 (__time64_t time1, __time64_t time0); |
| 141 | libc_hidden_proto (__difftime64) |
| 142 | #endif |
| 143 | |
| 144 | extern double __difftime (time_t time1, time_t time0); |
| 145 | |
| 146 | |
| 147 | /* Use in the clock_* functions. Size of the field representing the |
| 148 | actual clock ID. */ |
| 149 | #define CLOCK_IDFIELD_SIZE 3 |
| 150 | |
| 151 | /* Check whether T fits in time_t. */ |
| 152 | static inline bool |
| 153 | in_time_t_range (__time64_t t) |
| 154 | { |
| 155 | time_t s = t; |
| 156 | return s == t; |
| 157 | } |
| 158 | |
| 159 | #endif |
| 160 | #endif |
| 161 | |