0bda094cb44635c58de58a0bba7a1fc49597f00c
[platform/upstream/glibc.git] / include / time.h
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>
7
8 __BEGIN_DECLS
9
10 extern __typeof (strftime_l) __strftime_l;
11 libc_hidden_proto (__strftime_l)
12 extern __typeof (strptime_l) __strptime_l;
13
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)
21
22 librt_hidden_proto (clock_gettime)
23
24 /* Now define the internal interfaces.  */
25 struct tm;
26
27 /* Defined in mktime.c.  */
28 extern const unsigned short int __mon_yday[2][13] attribute_hidden;
29
30 /* Defined in localtime.c.  */
31 extern struct tm _tmbuf attribute_hidden;
32
33 /* Defined in tzset.c.  */
34 extern char *__tzstring (const char *string);
35
36 /* Defined in tzset.c. */
37 extern size_t __tzname_cur_max attribute_hidden;
38
39
40 extern int __use_tzfile attribute_hidden;
41
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);
49 extern void __tzset_parse_tz (const char *tz);
50 extern void __tz_compute (time_t timer, struct tm *tm, int use_localtime)
51      __THROW internal_function;
52
53 /* Subroutine of `mktime'.  Return the `time_t' representation of TP and
54    normalize TP, given that a `struct tm *' maps to a `time_t' as performed
55    by FUNC.  Keep track of next guess for time_t offset in *OFFSET.  */
56 extern time_t __mktime_internal (struct tm *__tp,
57                                  struct tm *(*__func) (const time_t *,
58                                                        struct tm *),
59                                  time_t *__offset);
60 extern struct tm *__localtime_r (const time_t *__timer,
61                                  struct tm *__tp) attribute_hidden;
62
63 extern struct tm *__gmtime_r (const time_t *__restrict __timer,
64                               struct tm *__restrict __tp);
65 libc_hidden_proto (__gmtime_r)
66
67 /* Compute the `struct tm' representation of *T,
68    offset OFFSET seconds east of UTC,
69    and store year, yday, mon, mday, wday, hour, min, sec into *TP.
70    Return nonzero if successful.  */
71 extern int __offtime (const time_t *__timer,
72                       long int __offset,
73                       struct tm *__tp);
74
75 extern char *__asctime_r (const struct tm *__tp, char *__buf);
76 extern void __tzset (void);
77
78 /* Prototype for the internal function to get information based on TZ.  */
79 extern struct tm *__tz_convert (const time_t *timer, int use_localtime, struct tm *tp);
80
81 /* Return the maximum length of a timezone name.
82    This is what `sysconf (_SC_TZNAME_MAX)' does.  */
83 extern long int __tzname_max (void);
84
85 extern int __nanosleep (const struct timespec *__requested_time,
86                         struct timespec *__remaining);
87 libc_hidden_proto (__nanosleep)
88 extern int __nanosleep_nocancel (const struct timespec *__requested_time,
89                                  struct timespec *__remaining)
90   attribute_hidden;
91 extern int __getdate_r (const char *__string, struct tm *__resbufp);
92
93
94 /* Determine CLK_TCK value.  */
95 extern int __getclktck (void);
96
97
98 /* strptime support.  */
99 extern char * __strptime_internal (const char *rp, const char *fmt,
100                                    struct tm *tm, void *statep,
101                                    __locale_t locparam)
102      internal_function;
103
104 extern double __difftime (time_t time1, time_t time0);
105
106
107 /* Use in the clock_* functions.  Size of the field representing the
108    actual clock ID.  */
109 #ifndef _ISOMAC
110 # define CLOCK_IDFIELD_SIZE     3
111 #endif
112
113 __END_DECLS
114
115 #endif
116 #endif