* Makefile (tests): Add tst-sem10.
[glibc.git] / include / time.h
blobd71f985014efecf03c19baa8bae949f30cda10be
1 #ifndef _TIME_H
2 #if defined __need_time_t || defined __need_clock_t || defined __need_timespec
3 # include <time/time.h>
4 #else
5 # include <time/time.h>
6 # include <xlocale.h>
8 __BEGIN_DECLS
10 extern __typeof (strftime_l) __strftime_l;
11 libc_hidden_proto (__strftime_l)
12 extern __typeof (strptime_l) __strptime_l;
14 libc_hidden_proto (time)
15 libc_hidden_proto (asctime)
16 libc_hidden_proto (mktime)
17 libc_hidden_proto (timelocal)
18 libc_hidden_proto (localtime)
19 libc_hidden_proto (strftime)
20 libc_hidden_proto (strptime)
22 librt_hidden_proto (clock_gettime)
24 /* Now define the internal interfaces. */
25 struct tm;
27 /* Defined in mktime.c. */
28 extern const unsigned short int __mon_yday[2][13] attribute_hidden;
30 /* Defined in localtime.c. */
31 extern struct tm _tmbuf attribute_hidden;
33 /* Defined in tzset.c. */
34 extern char *__tzstring (const char *string);
36 /* Defined in tzset.c. */
37 extern size_t __tzname_cur_max attribute_hidden;
40 extern int __use_tzfile attribute_hidden;
42 extern void __tzfile_read (const char *file, size_t extra,
43 char **extrap);
44 extern void __tzfile_compute (time_t timer, int use_localtime,
45 long int *leap_correct, int *leap_hit,
46 struct tm *tp);
47 extern void __tzfile_default (const char *std, const char *dst,
48 long int stdoff, long int dstoff);
50 /* Subroutine of `mktime'. Return the `time_t' representation of TP and
51 normalize TP, given that a `struct tm *' maps to a `time_t' as performed
52 by FUNC. Keep track of next guess for time_t offset in *OFFSET. */
53 extern time_t __mktime_internal (struct tm *__tp,
54 struct tm *(*__func) (const time_t *,
55 struct tm *),
56 time_t *__offset);
57 extern struct tm *__localtime_r (__const time_t *__timer,
58 struct tm *__tp) attribute_hidden;
60 extern struct tm *__gmtime_r (__const time_t *__restrict __timer,
61 struct tm *__restrict __tp);
62 libc_hidden_proto (__gmtime_r)
64 /* Compute the `struct tm' representation of *T,
65 offset OFFSET seconds east of UTC,
66 and store year, yday, mon, mday, wday, hour, min, sec into *TP.
67 Return nonzero if successful. */
68 extern int __offtime (__const time_t *__timer,
69 long int __offset,
70 struct tm *__tp);
72 extern char *__asctime_r (__const struct tm *__tp, char *__buf);
73 extern void __tzset (void);
75 /* Prototype for the internal function to get information based on TZ. */
76 extern struct tm *__tz_convert (const time_t *timer, int use_localtime, struct tm *tp);
78 /* Return the maximum length of a timezone name.
79 This is what `sysconf (_SC_TZNAME_MAX)' does. */
80 extern long int __tzname_max (void);
82 extern int __nanosleep (__const struct timespec *__requested_time,
83 struct timespec *__remaining);
84 libc_hidden_proto (__nanosleep)
85 extern int __nanosleep_nocancel (__const struct timespec *__requested_time,
86 struct timespec *__remaining)
87 attribute_hidden;
88 extern int __getdate_r (__const char *__string, struct tm *__resbufp);
91 /* Determine CLK_TCK value. */
92 extern int __getclktck (void);
95 /* strptime support. */
96 /* Status of lookup: do we use the locale data or the raw data? */
97 #ifndef __cplusplus
98 /* C++ cannot deal with using 'not'. */
99 enum ptime_locale_status { not, loc, raw };
101 extern char * __strptime_internal (const char *rp, const char *fmt,
102 struct tm *tm,
103 enum ptime_locale_status *decided,
104 int era_cnt, __locale_t locparam)
105 internal_function;
106 #endif
108 extern double __difftime (time_t time1, time_t time0);
111 /* Use in the clock_* functions. Size of the field representing the
112 actual clock ID. */
113 #ifndef _ISOMAC
114 # define CLOCK_IDFIELD_SIZE 3
115 #endif
117 __END_DECLS
119 #endif
120 #endif