2004-11-29 Roland McGrath <roland@redhat.com>
[glibc.git] / include / time.h
blob795eb5f50436c3dd586ae537a27ad62f30149fcc
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 extern __typeof (strftime_l) __strftime_l;
9 libc_hidden_proto (__strftime_l)
10 extern __typeof (strptime_l) __strptime_l;
12 libc_hidden_proto (time)
13 libc_hidden_proto (asctime)
14 libc_hidden_proto (mktime)
15 libc_hidden_proto (timelocal)
16 libc_hidden_proto (localtime)
17 libc_hidden_proto (strftime)
18 libc_hidden_proto (strptime)
20 /* Now define the internal interfaces. */
21 struct tm;
23 /* Defined in mktime.c. */
24 extern const unsigned short int __mon_yday[2][13] attribute_hidden;
26 /* Defined in localtime.c. */
27 extern struct tm _tmbuf attribute_hidden;
29 /* Defined in tzset.c. */
30 extern char *__tzstring (const char *string);
32 /* Defined in tzset.c. */
33 extern size_t __tzname_cur_max attribute_hidden;
36 extern int __use_tzfile attribute_hidden;
38 extern void __tzfile_read (const char *file, size_t extra,
39 char **extrap);
40 extern void __tzfile_compute (time_t timer, int use_localtime,
41 long int *leap_correct, int *leap_hit,
42 struct tm *tp);
43 extern void __tzfile_default (const char *std, const char *dst,
44 long int stdoff, long int dstoff);
46 /* Subroutine of `mktime'. Return the `time_t' representation of TP and
47 normalize TP, given that a `struct tm *' maps to a `time_t' as performed
48 by FUNC. Keep track of next guess for time_t offset in *OFFSET. */
49 extern time_t __mktime_internal (struct tm *__tp,
50 struct tm *(*__func) (const time_t *,
51 struct tm *),
52 time_t *__offset);
53 extern struct tm *__localtime_r (__const time_t *__timer,
54 struct tm *__tp) attribute_hidden;
56 extern struct tm *__gmtime_r (__const time_t *__restrict __timer,
57 struct tm *__restrict __tp);
58 libc_hidden_proto (__gmtime_r)
60 /* Compute the `struct tm' representation of *T,
61 offset OFFSET seconds east of UTC,
62 and store year, yday, mon, mday, wday, hour, min, sec into *TP.
63 Return nonzero if successful. */
64 extern int __offtime (__const time_t *__timer,
65 long int __offset,
66 struct tm *__tp);
68 extern char *__asctime_r (__const struct tm *__tp, char *__buf);
69 extern void __tzset (void);
71 /* Prototype for the internal function to get information based on TZ. */
72 extern struct tm *__tz_convert (const time_t *timer, int use_localtime, struct tm *tp);
74 /* Return the maximum length of a timezone name.
75 This is what `sysconf (_SC_TZNAME_MAX)' does. */
76 extern long int __tzname_max (void);
78 extern int __nanosleep (__const struct timespec *__requested_time,
79 struct timespec *__remaining);
80 libc_hidden_proto(__nanosleep)
81 extern int __getdate_r (__const char *__string, struct tm *__resbufp);
84 /* Determine CLK_TCK value. */
85 extern int __getclktck (void);
88 /* strptime support. */
89 /* Status of lookup: do we use the locale data or the raw data? */
90 enum ptime_locale_status { not, loc, raw };
92 extern char * __strptime_internal (const char *rp, const char *fmt,
93 struct tm *tm,
94 enum ptime_locale_status *decided,
95 int era_cnt, __locale_t loc)
96 internal_function;
98 extern double __difftime (time_t time1, time_t time0);
101 /* Use in the clock_* functions. Size of the field representing the
102 actual clock ID. */
103 #ifndef _ISOMAC
104 # define CLOCK_IDFIELD_SIZE 3
105 #endif
106 #endif
107 #endif