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
9extern __typeof (strftime_l) __strftime_l;
10libc_hidden_proto (__strftime_l)
11extern __typeof (strptime_l) __strptime_l;
12
13libc_hidden_proto (time)
14libc_hidden_proto (asctime)
15libc_hidden_proto (mktime)
16libc_hidden_proto (timelocal)
17libc_hidden_proto (localtime)
18libc_hidden_proto (strftime)
19libc_hidden_proto (strptime)
20
21extern __typeof (clock_getres) __clock_getres;
22extern __typeof (clock_gettime) __clock_gettime;
23libc_hidden_proto (__clock_gettime)
24extern __typeof (clock_settime) __clock_settime;
25extern __typeof (clock_nanosleep) __clock_nanosleep;
26extern __typeof (clock_getcpuclockid) __clock_getcpuclockid;
27
28/* Now define the internal interfaces. */
29struct tm;
30
31/* Defined in mktime.c. */
32extern const unsigned short int __mon_yday[2][13] attribute_hidden;
33
34/* Defined in localtime.c. */
35extern struct tm _tmbuf attribute_hidden;
36
37/* Defined in tzset.c. */
38extern char *__tzstring (const char *string) attribute_hidden;
39
40extern int __use_tzfile attribute_hidden;
41
42extern void __tzfile_read (const char *file, size_t extra,
43 char **extrap) attribute_hidden;
44extern void __tzfile_compute (__time64_t timer, int use_localtime,
45 long int *leap_correct, int *leap_hit,
46 struct tm *tp) attribute_hidden;
47extern void __tzfile_default (const char *std, const char *dst,
48 int stdoff, int dstoff)
49 attribute_hidden;
50extern void __tzset_parse_tz (const char *tz) attribute_hidden;
51extern 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
57extern char *__ctime64 (const __time64_t *__timer) __THROW;
58libc_hidden_proto (__ctime64)
59#endif
60
61#if __TIMESIZE == 64
62# define __ctime64_r ctime_r
63#else
64extern char *__ctime64_r (const __time64_t *__restrict __timer,
65 char *__restrict __buf) __THROW;
66libc_hidden_proto (__ctime64_r)
67#endif
68
69#if __TIMESIZE == 64
70# define __localtime64 localtime
71#else
72extern struct tm *__localtime64 (const __time64_t *__timer);
73libc_hidden_proto (__localtime64)
74#endif
75
76extern struct tm *__localtime_r (const time_t *__timer,
77 struct tm *__tp) attribute_hidden;
78#if __TIMESIZE != 64
79extern struct tm *__localtime64_r (const __time64_t *__timer,
80 struct tm *__tp);
81libc_hidden_proto (__localtime64_r)
82
83extern __time64_t __mktime64 (struct tm *__tp) __THROW;
84libc_hidden_proto (__mktime64)
85#endif
86
87extern struct tm *__gmtime_r (const time_t *__restrict __timer,
88 struct tm *__restrict __tp);
89libc_hidden_proto (__gmtime_r)
90
91#if __TIMESIZE == 64
92# define __gmtime64 gmtime
93#else
94extern struct tm *__gmtime64 (const __time64_t *__timer);
95libc_hidden_proto (__gmtime64)
96
97extern struct tm *__gmtime64_r (const __time64_t *__restrict __timer,
98 struct tm *__restrict __tp);
99libc_hidden_proto (__gmtime64_r)
100
101extern __time64_t __timegm64 (struct tm *__tp) __THROW;
102libc_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. */
109extern int __offtime (__time64_t __timer,
110 long int __offset,
111 struct tm *__tp) attribute_hidden;
112
113extern char *__asctime_r (const struct tm *__tp, char *__buf)
114 attribute_hidden;
115extern void __tzset (void) attribute_hidden;
116
117/* Prototype for the internal function to get information based on TZ. */
118extern struct tm *__tz_convert (__time64_t timer, int use_localtime,
119 struct tm *tp) attribute_hidden;
120
121extern int __nanosleep (const struct timespec *__requested_time,
122 struct timespec *__remaining);
123hidden_proto (__nanosleep)
124extern int __getdate_r (const char *__string, struct tm *__resbufp)
125 attribute_hidden;
126
127
128/* Determine CLK_TCK value. */
129extern int __getclktck (void) attribute_hidden;
130
131
132/* strptime support. */
133extern 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
140extern double __difftime64 (__time64_t time1, __time64_t time0);
141libc_hidden_proto (__difftime64)
142#endif
143
144extern 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. */
152static inline bool
153in_time_t_range (__time64_t t)
154{
155 time_t s = t;
156 return s == t;
157}
158
159#endif
160#endif
161