xref: /utopia/UTPA2-700.0.x/projects/tools/lint/mips-linux-gnu_include/time.h (revision 53ee8cc121a030b8d368113ac3e966b4705770ef)
1*53ee8cc1Swenshuai.xi /* Copyright (C) 1991-1999,2000,2001,2002,2003,2006
2*53ee8cc1Swenshuai.xi 	Free Software Foundation, Inc.
3*53ee8cc1Swenshuai.xi    This file is part of the GNU C Library.
4*53ee8cc1Swenshuai.xi 
5*53ee8cc1Swenshuai.xi    The GNU C Library is free software; you can redistribute it and/or
6*53ee8cc1Swenshuai.xi    modify it under the terms of the GNU Lesser General Public
7*53ee8cc1Swenshuai.xi    License as published by the Free Software Foundation; either
8*53ee8cc1Swenshuai.xi    version 2.1 of the License, or (at your option) any later version.
9*53ee8cc1Swenshuai.xi 
10*53ee8cc1Swenshuai.xi    The GNU C Library is distributed in the hope that it will be useful,
11*53ee8cc1Swenshuai.xi    but WITHOUT ANY WARRANTY; without even the implied warranty of
12*53ee8cc1Swenshuai.xi    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13*53ee8cc1Swenshuai.xi    Lesser General Public License for more details.
14*53ee8cc1Swenshuai.xi 
15*53ee8cc1Swenshuai.xi    You should have received a copy of the GNU Lesser General Public
16*53ee8cc1Swenshuai.xi    License along with the GNU C Library; if not, write to the Free
17*53ee8cc1Swenshuai.xi    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18*53ee8cc1Swenshuai.xi    02111-1307 USA.  */
19*53ee8cc1Swenshuai.xi 
20*53ee8cc1Swenshuai.xi /*
21*53ee8cc1Swenshuai.xi  *	ISO C99 Standard: 7.23 Date and time	<time.h>
22*53ee8cc1Swenshuai.xi  */
23*53ee8cc1Swenshuai.xi 
24*53ee8cc1Swenshuai.xi #ifndef	_TIME_H
25*53ee8cc1Swenshuai.xi 
26*53ee8cc1Swenshuai.xi #if (! defined __need_time_t && !defined __need_clock_t && \
27*53ee8cc1Swenshuai.xi      ! defined __need_timespec)
28*53ee8cc1Swenshuai.xi # define _TIME_H	1
29*53ee8cc1Swenshuai.xi # include <features.h>
30*53ee8cc1Swenshuai.xi 
31*53ee8cc1Swenshuai.xi __BEGIN_DECLS
32*53ee8cc1Swenshuai.xi 
33*53ee8cc1Swenshuai.xi #endif
34*53ee8cc1Swenshuai.xi 
35*53ee8cc1Swenshuai.xi #ifdef	_TIME_H
36*53ee8cc1Swenshuai.xi /* Get size_t and NULL from <stddef.h>.  */
37*53ee8cc1Swenshuai.xi # define __need_size_t
38*53ee8cc1Swenshuai.xi # define __need_NULL
39*53ee8cc1Swenshuai.xi # include <stddef.h>
40*53ee8cc1Swenshuai.xi 
41*53ee8cc1Swenshuai.xi /* This defines CLOCKS_PER_SEC, which is the number of processor clock
42*53ee8cc1Swenshuai.xi    ticks per second.  */
43*53ee8cc1Swenshuai.xi # include <bits/time.h>
44*53ee8cc1Swenshuai.xi 
45*53ee8cc1Swenshuai.xi /* This is the obsolete POSIX.1-1988 name for the same constant.  */
46*53ee8cc1Swenshuai.xi # if !defined __STRICT_ANSI__ && !defined __USE_XOPEN2K
47*53ee8cc1Swenshuai.xi #  ifndef CLK_TCK
48*53ee8cc1Swenshuai.xi #   define CLK_TCK	CLOCKS_PER_SEC
49*53ee8cc1Swenshuai.xi #  endif
50*53ee8cc1Swenshuai.xi # endif
51*53ee8cc1Swenshuai.xi 
52*53ee8cc1Swenshuai.xi #endif /* <time.h> included.  */
53*53ee8cc1Swenshuai.xi 
54*53ee8cc1Swenshuai.xi #if !defined __clock_t_defined && (defined _TIME_H || defined __need_clock_t)
55*53ee8cc1Swenshuai.xi # define __clock_t_defined	1
56*53ee8cc1Swenshuai.xi 
57*53ee8cc1Swenshuai.xi # include <bits/types.h>
58*53ee8cc1Swenshuai.xi 
59*53ee8cc1Swenshuai.xi __BEGIN_NAMESPACE_STD
60*53ee8cc1Swenshuai.xi /* Returned by `clock'.  */
61*53ee8cc1Swenshuai.xi typedef __clock_t clock_t;
62*53ee8cc1Swenshuai.xi __END_NAMESPACE_STD
63*53ee8cc1Swenshuai.xi #if defined __USE_XOPEN || defined __USE_POSIX || defined __USE_MISC
64*53ee8cc1Swenshuai.xi __USING_NAMESPACE_STD(clock_t)
65*53ee8cc1Swenshuai.xi #endif
66*53ee8cc1Swenshuai.xi 
67*53ee8cc1Swenshuai.xi #endif /* clock_t not defined and <time.h> or need clock_t.  */
68*53ee8cc1Swenshuai.xi #undef	__need_clock_t
69*53ee8cc1Swenshuai.xi 
70*53ee8cc1Swenshuai.xi #if !defined __time_t_defined && (defined _TIME_H || defined __need_time_t)
71*53ee8cc1Swenshuai.xi # define __time_t_defined	1
72*53ee8cc1Swenshuai.xi 
73*53ee8cc1Swenshuai.xi # include <bits/types.h>
74*53ee8cc1Swenshuai.xi 
75*53ee8cc1Swenshuai.xi __BEGIN_NAMESPACE_STD
76*53ee8cc1Swenshuai.xi /* Returned by `time'.  */
77*53ee8cc1Swenshuai.xi typedef __time_t time_t;
78*53ee8cc1Swenshuai.xi __END_NAMESPACE_STD
79*53ee8cc1Swenshuai.xi #if defined __USE_POSIX || defined __USE_MISC || defined __USE_SVID
80*53ee8cc1Swenshuai.xi __USING_NAMESPACE_STD(time_t)
81*53ee8cc1Swenshuai.xi #endif
82*53ee8cc1Swenshuai.xi 
83*53ee8cc1Swenshuai.xi #endif /* time_t not defined and <time.h> or need time_t.  */
84*53ee8cc1Swenshuai.xi #undef	__need_time_t
85*53ee8cc1Swenshuai.xi 
86*53ee8cc1Swenshuai.xi #if !defined __clockid_t_defined && \
87*53ee8cc1Swenshuai.xi    ((defined _TIME_H && defined __USE_POSIX199309) || defined __need_clockid_t)
88*53ee8cc1Swenshuai.xi # define __clockid_t_defined	1
89*53ee8cc1Swenshuai.xi 
90*53ee8cc1Swenshuai.xi # include <bits/types.h>
91*53ee8cc1Swenshuai.xi 
92*53ee8cc1Swenshuai.xi /* Clock ID used in clock and timer functions.  */
93*53ee8cc1Swenshuai.xi typedef __clockid_t clockid_t;
94*53ee8cc1Swenshuai.xi 
95*53ee8cc1Swenshuai.xi #endif /* clockid_t not defined and <time.h> or need clockid_t.  */
96*53ee8cc1Swenshuai.xi #undef	__clockid_time_t
97*53ee8cc1Swenshuai.xi 
98*53ee8cc1Swenshuai.xi #if !defined __timer_t_defined && \
99*53ee8cc1Swenshuai.xi     ((defined _TIME_H && defined __USE_POSIX199309) || defined __need_timer_t)
100*53ee8cc1Swenshuai.xi # define __timer_t_defined	1
101*53ee8cc1Swenshuai.xi 
102*53ee8cc1Swenshuai.xi # include <bits/types.h>
103*53ee8cc1Swenshuai.xi 
104*53ee8cc1Swenshuai.xi /* Timer ID returned by `timer_create'.  */
105*53ee8cc1Swenshuai.xi typedef __timer_t timer_t;
106*53ee8cc1Swenshuai.xi 
107*53ee8cc1Swenshuai.xi #endif /* timer_t not defined and <time.h> or need timer_t.  */
108*53ee8cc1Swenshuai.xi #undef	__need_timer_t
109*53ee8cc1Swenshuai.xi 
110*53ee8cc1Swenshuai.xi 
111*53ee8cc1Swenshuai.xi #if !defined __timespec_defined &&				\
112*53ee8cc1Swenshuai.xi     ((defined _TIME_H &&					\
113*53ee8cc1Swenshuai.xi       (defined __USE_POSIX199309 || defined __USE_MISC)) ||	\
114*53ee8cc1Swenshuai.xi       defined __need_timespec)
115*53ee8cc1Swenshuai.xi # define __timespec_defined	1
116*53ee8cc1Swenshuai.xi 
117*53ee8cc1Swenshuai.xi # include <bits/types.h>	/* This defines __time_t for us.  */
118*53ee8cc1Swenshuai.xi 
119*53ee8cc1Swenshuai.xi /* POSIX.1b structure for a time value.  This is like a `struct timeval' but
120*53ee8cc1Swenshuai.xi    has nanoseconds instead of microseconds.  */
121*53ee8cc1Swenshuai.xi struct timespec
122*53ee8cc1Swenshuai.xi   {
123*53ee8cc1Swenshuai.xi     __time_t tv_sec;		/* Seconds.  */
124*53ee8cc1Swenshuai.xi     long int tv_nsec;		/* Nanoseconds.  */
125*53ee8cc1Swenshuai.xi   };
126*53ee8cc1Swenshuai.xi 
127*53ee8cc1Swenshuai.xi #endif /* timespec not defined and <time.h> or need timespec.  */
128*53ee8cc1Swenshuai.xi #undef	__need_timespec
129*53ee8cc1Swenshuai.xi 
130*53ee8cc1Swenshuai.xi 
131*53ee8cc1Swenshuai.xi #ifdef	_TIME_H
132*53ee8cc1Swenshuai.xi __BEGIN_NAMESPACE_STD
133*53ee8cc1Swenshuai.xi /* Used by other time functions.  */
134*53ee8cc1Swenshuai.xi struct tm
135*53ee8cc1Swenshuai.xi {
136*53ee8cc1Swenshuai.xi   int tm_sec;			/* Seconds.	[0-60] (1 leap second) */
137*53ee8cc1Swenshuai.xi   int tm_min;			/* Minutes.	[0-59] */
138*53ee8cc1Swenshuai.xi   int tm_hour;			/* Hours.	[0-23] */
139*53ee8cc1Swenshuai.xi   int tm_mday;			/* Day.		[1-31] */
140*53ee8cc1Swenshuai.xi   int tm_mon;			/* Month.	[0-11] */
141*53ee8cc1Swenshuai.xi   int tm_year;			/* Year	- 1900.  */
142*53ee8cc1Swenshuai.xi   int tm_wday;			/* Day of week.	[0-6] */
143*53ee8cc1Swenshuai.xi   int tm_yday;			/* Days in year.[0-365]	*/
144*53ee8cc1Swenshuai.xi   int tm_isdst;			/* DST.		[-1/0/1]*/
145*53ee8cc1Swenshuai.xi 
146*53ee8cc1Swenshuai.xi #ifdef	__USE_BSD
147*53ee8cc1Swenshuai.xi   long int tm_gmtoff;		/* Seconds east of UTC.  */
148*53ee8cc1Swenshuai.xi   __const char *tm_zone;	/* Timezone abbreviation.  */
149*53ee8cc1Swenshuai.xi #else
150*53ee8cc1Swenshuai.xi   long int __tm_gmtoff;		/* Seconds east of UTC.  */
151*53ee8cc1Swenshuai.xi   __const char *__tm_zone;	/* Timezone abbreviation.  */
152*53ee8cc1Swenshuai.xi #endif
153*53ee8cc1Swenshuai.xi };
154*53ee8cc1Swenshuai.xi __END_NAMESPACE_STD
155*53ee8cc1Swenshuai.xi #if defined __USE_XOPEN || defined __USE_POSIX || defined __USE_MISC
156*53ee8cc1Swenshuai.xi __USING_NAMESPACE_STD(tm)
157*53ee8cc1Swenshuai.xi #endif
158*53ee8cc1Swenshuai.xi 
159*53ee8cc1Swenshuai.xi 
160*53ee8cc1Swenshuai.xi #ifdef __USE_POSIX199309
161*53ee8cc1Swenshuai.xi /* POSIX.1b structure for timer start values and intervals.  */
162*53ee8cc1Swenshuai.xi struct itimerspec
163*53ee8cc1Swenshuai.xi   {
164*53ee8cc1Swenshuai.xi     struct timespec it_interval;
165*53ee8cc1Swenshuai.xi     struct timespec it_value;
166*53ee8cc1Swenshuai.xi   };
167*53ee8cc1Swenshuai.xi 
168*53ee8cc1Swenshuai.xi /* We can use a simple forward declaration.  */
169*53ee8cc1Swenshuai.xi struct sigevent;
170*53ee8cc1Swenshuai.xi 
171*53ee8cc1Swenshuai.xi #endif	/* POSIX.1b */
172*53ee8cc1Swenshuai.xi 
173*53ee8cc1Swenshuai.xi #ifdef __USE_XOPEN2K
174*53ee8cc1Swenshuai.xi # ifndef __pid_t_defined
175*53ee8cc1Swenshuai.xi typedef __pid_t pid_t;
176*53ee8cc1Swenshuai.xi #  define __pid_t_defined
177*53ee8cc1Swenshuai.xi # endif
178*53ee8cc1Swenshuai.xi #endif
179*53ee8cc1Swenshuai.xi 
180*53ee8cc1Swenshuai.xi 
181*53ee8cc1Swenshuai.xi __BEGIN_NAMESPACE_STD
182*53ee8cc1Swenshuai.xi /* Time used by the program so far (user time + system time).
183*53ee8cc1Swenshuai.xi    The result / CLOCKS_PER_SECOND is program time in seconds.  */
184*53ee8cc1Swenshuai.xi extern clock_t clock (void) __THROW;
185*53ee8cc1Swenshuai.xi 
186*53ee8cc1Swenshuai.xi /* Return the current time and put it in *TIMER if TIMER is not NULL.  */
187*53ee8cc1Swenshuai.xi extern time_t time (time_t *__timer) __THROW;
188*53ee8cc1Swenshuai.xi 
189*53ee8cc1Swenshuai.xi /* Return the difference between TIME1 and TIME0.  */
190*53ee8cc1Swenshuai.xi extern double difftime (time_t __time1, time_t __time0)
191*53ee8cc1Swenshuai.xi      __THROW __attribute__ ((__const__));
192*53ee8cc1Swenshuai.xi 
193*53ee8cc1Swenshuai.xi /* Return the `time_t' representation of TP and normalize TP.  */
194*53ee8cc1Swenshuai.xi extern time_t mktime (struct tm *__tp) __THROW;
195*53ee8cc1Swenshuai.xi 
196*53ee8cc1Swenshuai.xi 
197*53ee8cc1Swenshuai.xi /* Format TP into S according to FORMAT.
198*53ee8cc1Swenshuai.xi    Write no more than MAXSIZE characters and return the number
199*53ee8cc1Swenshuai.xi    of characters written, or 0 if it would exceed MAXSIZE.  */
200*53ee8cc1Swenshuai.xi extern size_t strftime (char *__restrict __s, size_t __maxsize,
201*53ee8cc1Swenshuai.xi 			__const char *__restrict __format,
202*53ee8cc1Swenshuai.xi 			__const struct tm *__restrict __tp) __THROW;
203*53ee8cc1Swenshuai.xi __END_NAMESPACE_STD
204*53ee8cc1Swenshuai.xi 
205*53ee8cc1Swenshuai.xi # ifdef __USE_XOPEN
206*53ee8cc1Swenshuai.xi /* Parse S according to FORMAT and store binary time information in TP.
207*53ee8cc1Swenshuai.xi    The return value is a pointer to the first unparsed character in S.  */
208*53ee8cc1Swenshuai.xi extern char *strptime (__const char *__restrict __s,
209*53ee8cc1Swenshuai.xi 		       __const char *__restrict __fmt, struct tm *__tp)
210*53ee8cc1Swenshuai.xi      __THROW;
211*53ee8cc1Swenshuai.xi # endif
212*53ee8cc1Swenshuai.xi 
213*53ee8cc1Swenshuai.xi # ifdef __USE_GNU
214*53ee8cc1Swenshuai.xi /* Similar to the two functions above but take the information from
215*53ee8cc1Swenshuai.xi    the provided locale and not the global locale.  */
216*53ee8cc1Swenshuai.xi # include <xlocale.h>
217*53ee8cc1Swenshuai.xi 
218*53ee8cc1Swenshuai.xi extern size_t strftime_l (char *__restrict __s, size_t __maxsize,
219*53ee8cc1Swenshuai.xi 			  __const char *__restrict __format,
220*53ee8cc1Swenshuai.xi 			  __const struct tm *__restrict __tp,
221*53ee8cc1Swenshuai.xi 			  __locale_t __loc) __THROW;
222*53ee8cc1Swenshuai.xi 
223*53ee8cc1Swenshuai.xi extern char *strptime_l (__const char *__restrict __s,
224*53ee8cc1Swenshuai.xi 			 __const char *__restrict __fmt, struct tm *__tp,
225*53ee8cc1Swenshuai.xi 			 __locale_t __loc) __THROW;
226*53ee8cc1Swenshuai.xi # endif
227*53ee8cc1Swenshuai.xi 
228*53ee8cc1Swenshuai.xi 
229*53ee8cc1Swenshuai.xi __BEGIN_NAMESPACE_STD
230*53ee8cc1Swenshuai.xi /* Return the `struct tm' representation of *TIMER
231*53ee8cc1Swenshuai.xi    in Universal Coordinated Time (aka Greenwich Mean Time).  */
232*53ee8cc1Swenshuai.xi extern struct tm *gmtime (__const time_t *__timer) __THROW;
233*53ee8cc1Swenshuai.xi 
234*53ee8cc1Swenshuai.xi /* Return the `struct tm' representation
235*53ee8cc1Swenshuai.xi    of *TIMER in the local timezone.  */
236*53ee8cc1Swenshuai.xi extern struct tm *localtime (__const time_t *__timer) __THROW;
237*53ee8cc1Swenshuai.xi __END_NAMESPACE_STD
238*53ee8cc1Swenshuai.xi 
239*53ee8cc1Swenshuai.xi # if defined __USE_POSIX || defined __USE_MISC
240*53ee8cc1Swenshuai.xi /* Return the `struct tm' representation of *TIMER in UTC,
241*53ee8cc1Swenshuai.xi    using *TP to store the result.  */
242*53ee8cc1Swenshuai.xi extern struct tm *gmtime_r (__const time_t *__restrict __timer,
243*53ee8cc1Swenshuai.xi 			    struct tm *__restrict __tp) __THROW;
244*53ee8cc1Swenshuai.xi 
245*53ee8cc1Swenshuai.xi /* Return the `struct tm' representation of *TIMER in local time,
246*53ee8cc1Swenshuai.xi    using *TP to store the result.  */
247*53ee8cc1Swenshuai.xi extern struct tm *localtime_r (__const time_t *__restrict __timer,
248*53ee8cc1Swenshuai.xi 			       struct tm *__restrict __tp) __THROW;
249*53ee8cc1Swenshuai.xi # endif	/* POSIX or misc */
250*53ee8cc1Swenshuai.xi 
251*53ee8cc1Swenshuai.xi __BEGIN_NAMESPACE_STD
252*53ee8cc1Swenshuai.xi /* Return a string of the form "Day Mon dd hh:mm:ss yyyy\n"
253*53ee8cc1Swenshuai.xi    that is the representation of TP in this format.  */
254*53ee8cc1Swenshuai.xi extern char *asctime (__const struct tm *__tp) __THROW;
255*53ee8cc1Swenshuai.xi 
256*53ee8cc1Swenshuai.xi /* Equivalent to `asctime (localtime (timer))'.  */
257*53ee8cc1Swenshuai.xi extern char *ctime (__const time_t *__timer) __THROW;
258*53ee8cc1Swenshuai.xi __END_NAMESPACE_STD
259*53ee8cc1Swenshuai.xi 
260*53ee8cc1Swenshuai.xi # if defined __USE_POSIX || defined __USE_MISC
261*53ee8cc1Swenshuai.xi /* Reentrant versions of the above functions.  */
262*53ee8cc1Swenshuai.xi 
263*53ee8cc1Swenshuai.xi /* Return in BUF a string of the form "Day Mon dd hh:mm:ss yyyy\n"
264*53ee8cc1Swenshuai.xi    that is the representation of TP in this format.  */
265*53ee8cc1Swenshuai.xi extern char *asctime_r (__const struct tm *__restrict __tp,
266*53ee8cc1Swenshuai.xi 			char *__restrict __buf) __THROW;
267*53ee8cc1Swenshuai.xi 
268*53ee8cc1Swenshuai.xi /* Equivalent to `asctime_r (localtime_r (timer, *TMP*), buf)'.  */
269*53ee8cc1Swenshuai.xi extern char *ctime_r (__const time_t *__restrict __timer,
270*53ee8cc1Swenshuai.xi 		      char *__restrict __buf) __THROW;
271*53ee8cc1Swenshuai.xi # endif	/* POSIX or misc */
272*53ee8cc1Swenshuai.xi 
273*53ee8cc1Swenshuai.xi 
274*53ee8cc1Swenshuai.xi /* Defined in localtime.c.  */
275*53ee8cc1Swenshuai.xi extern char *__tzname[2];	/* Current timezone names.  */
276*53ee8cc1Swenshuai.xi extern int __daylight;		/* If daylight-saving time is ever in use.  */
277*53ee8cc1Swenshuai.xi extern long int __timezone;	/* Seconds west of UTC.  */
278*53ee8cc1Swenshuai.xi 
279*53ee8cc1Swenshuai.xi 
280*53ee8cc1Swenshuai.xi # ifdef	__USE_POSIX
281*53ee8cc1Swenshuai.xi /* Same as above.  */
282*53ee8cc1Swenshuai.xi extern char *tzname[2];
283*53ee8cc1Swenshuai.xi 
284*53ee8cc1Swenshuai.xi /* Set time conversion information from the TZ environment variable.
285*53ee8cc1Swenshuai.xi    If TZ is not defined, a locale-dependent default is used.  */
286*53ee8cc1Swenshuai.xi extern void tzset (void) __THROW;
287*53ee8cc1Swenshuai.xi # endif
288*53ee8cc1Swenshuai.xi 
289*53ee8cc1Swenshuai.xi # if defined __USE_SVID || defined __USE_XOPEN
290*53ee8cc1Swenshuai.xi extern int daylight;
291*53ee8cc1Swenshuai.xi extern long int timezone;
292*53ee8cc1Swenshuai.xi # endif
293*53ee8cc1Swenshuai.xi 
294*53ee8cc1Swenshuai.xi # ifdef __USE_SVID
295*53ee8cc1Swenshuai.xi /* Set the system time to *WHEN.
296*53ee8cc1Swenshuai.xi    This call is restricted to the superuser.  */
297*53ee8cc1Swenshuai.xi extern int stime (__const time_t *__when) __THROW;
298*53ee8cc1Swenshuai.xi # endif
299*53ee8cc1Swenshuai.xi 
300*53ee8cc1Swenshuai.xi 
301*53ee8cc1Swenshuai.xi /* Nonzero if YEAR is a leap year (every 4 years,
302*53ee8cc1Swenshuai.xi    except every 100th isn't, and every 400th is).  */
303*53ee8cc1Swenshuai.xi # define __isleap(year)	\
304*53ee8cc1Swenshuai.xi   ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))
305*53ee8cc1Swenshuai.xi 
306*53ee8cc1Swenshuai.xi 
307*53ee8cc1Swenshuai.xi # ifdef __USE_MISC
308*53ee8cc1Swenshuai.xi /* Miscellaneous functions many Unices inherited from the public domain
309*53ee8cc1Swenshuai.xi    localtime package.  These are included only for compatibility.  */
310*53ee8cc1Swenshuai.xi 
311*53ee8cc1Swenshuai.xi /* Like `mktime', but for TP represents Universal Time, not local time.  */
312*53ee8cc1Swenshuai.xi extern time_t timegm (struct tm *__tp) __THROW;
313*53ee8cc1Swenshuai.xi 
314*53ee8cc1Swenshuai.xi /* Another name for `mktime'.  */
315*53ee8cc1Swenshuai.xi extern time_t timelocal (struct tm *__tp) __THROW;
316*53ee8cc1Swenshuai.xi 
317*53ee8cc1Swenshuai.xi /* Return the number of days in YEAR.  */
318*53ee8cc1Swenshuai.xi extern int dysize (int __year) __THROW  __attribute__ ((__const__));
319*53ee8cc1Swenshuai.xi # endif
320*53ee8cc1Swenshuai.xi 
321*53ee8cc1Swenshuai.xi 
322*53ee8cc1Swenshuai.xi # ifdef __USE_POSIX199309
323*53ee8cc1Swenshuai.xi /* Pause execution for a number of nanoseconds.
324*53ee8cc1Swenshuai.xi 
325*53ee8cc1Swenshuai.xi    This function is a cancellation point and therefore not marked with
326*53ee8cc1Swenshuai.xi    __THROW.  */
327*53ee8cc1Swenshuai.xi extern int nanosleep (__const struct timespec *__requested_time,
328*53ee8cc1Swenshuai.xi 		      struct timespec *__remaining);
329*53ee8cc1Swenshuai.xi 
330*53ee8cc1Swenshuai.xi 
331*53ee8cc1Swenshuai.xi /* Get resolution of clock CLOCK_ID.  */
332*53ee8cc1Swenshuai.xi extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __THROW;
333*53ee8cc1Swenshuai.xi 
334*53ee8cc1Swenshuai.xi /* Get current value of clock CLOCK_ID and store it in TP.  */
335*53ee8cc1Swenshuai.xi extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __THROW;
336*53ee8cc1Swenshuai.xi 
337*53ee8cc1Swenshuai.xi /* Set clock CLOCK_ID to value TP.  */
338*53ee8cc1Swenshuai.xi extern int clock_settime (clockid_t __clock_id, __const struct timespec *__tp)
339*53ee8cc1Swenshuai.xi      __THROW;
340*53ee8cc1Swenshuai.xi 
341*53ee8cc1Swenshuai.xi #  ifdef __USE_XOPEN2K
342*53ee8cc1Swenshuai.xi /* High-resolution sleep with the specified clock.
343*53ee8cc1Swenshuai.xi 
344*53ee8cc1Swenshuai.xi    This function is a cancellation point and therefore not marked with
345*53ee8cc1Swenshuai.xi    __THROW.  */
346*53ee8cc1Swenshuai.xi extern int clock_nanosleep (clockid_t __clock_id, int __flags,
347*53ee8cc1Swenshuai.xi 			    __const struct timespec *__req,
348*53ee8cc1Swenshuai.xi 			    struct timespec *__rem);
349*53ee8cc1Swenshuai.xi 
350*53ee8cc1Swenshuai.xi /* Return clock ID for CPU-time clock.  */
351*53ee8cc1Swenshuai.xi extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __THROW;
352*53ee8cc1Swenshuai.xi #  endif
353*53ee8cc1Swenshuai.xi 
354*53ee8cc1Swenshuai.xi 
355*53ee8cc1Swenshuai.xi /* Create new per-process timer using CLOCK_ID.  */
356*53ee8cc1Swenshuai.xi extern int timer_create (clockid_t __clock_id,
357*53ee8cc1Swenshuai.xi 			 struct sigevent *__restrict __evp,
358*53ee8cc1Swenshuai.xi 			 timer_t *__restrict __timerid) __THROW;
359*53ee8cc1Swenshuai.xi 
360*53ee8cc1Swenshuai.xi /* Delete timer TIMERID.  */
361*53ee8cc1Swenshuai.xi extern int timer_delete (timer_t __timerid) __THROW;
362*53ee8cc1Swenshuai.xi 
363*53ee8cc1Swenshuai.xi /* Set timer TIMERID to VALUE, returning old value in OVLAUE.  */
364*53ee8cc1Swenshuai.xi extern int timer_settime (timer_t __timerid, int __flags,
365*53ee8cc1Swenshuai.xi 			  __const struct itimerspec *__restrict __value,
366*53ee8cc1Swenshuai.xi 			  struct itimerspec *__restrict __ovalue) __THROW;
367*53ee8cc1Swenshuai.xi 
368*53ee8cc1Swenshuai.xi /* Get current value of timer TIMERID and store it in VLAUE.  */
369*53ee8cc1Swenshuai.xi extern int timer_gettime (timer_t __timerid, struct itimerspec *__value)
370*53ee8cc1Swenshuai.xi      __THROW;
371*53ee8cc1Swenshuai.xi 
372*53ee8cc1Swenshuai.xi /* Get expiration overrun for timer TIMERID.  */
373*53ee8cc1Swenshuai.xi extern int timer_getoverrun (timer_t __timerid) __THROW;
374*53ee8cc1Swenshuai.xi # endif
375*53ee8cc1Swenshuai.xi 
376*53ee8cc1Swenshuai.xi 
377*53ee8cc1Swenshuai.xi # ifdef __USE_XOPEN_EXTENDED
378*53ee8cc1Swenshuai.xi /* Set to one of the following values to indicate an error.
379*53ee8cc1Swenshuai.xi      1  the DATEMSK environment variable is null or undefined,
380*53ee8cc1Swenshuai.xi      2  the template file cannot be opened for reading,
381*53ee8cc1Swenshuai.xi      3  failed to get file status information,
382*53ee8cc1Swenshuai.xi      4  the template file is not a regular file,
383*53ee8cc1Swenshuai.xi      5  an error is encountered while reading the template file,
384*53ee8cc1Swenshuai.xi      6  memory allication failed (not enough memory available),
385*53ee8cc1Swenshuai.xi      7  there is no line in the template that matches the input,
386*53ee8cc1Swenshuai.xi      8  invalid input specification Example: February 31 or a time is
387*53ee8cc1Swenshuai.xi         specified that can not be represented in a time_t (representing
388*53ee8cc1Swenshuai.xi 	the time in seconds since 00:00:00 UTC, January 1, 1970) */
389*53ee8cc1Swenshuai.xi extern int getdate_err;
390*53ee8cc1Swenshuai.xi 
391*53ee8cc1Swenshuai.xi /* Parse the given string as a date specification and return a value
392*53ee8cc1Swenshuai.xi    representing the value.  The templates from the file identified by
393*53ee8cc1Swenshuai.xi    the environment variable DATEMSK are used.  In case of an error
394*53ee8cc1Swenshuai.xi    `getdate_err' is set.
395*53ee8cc1Swenshuai.xi 
396*53ee8cc1Swenshuai.xi    This function is a possible cancellation points and therefore not
397*53ee8cc1Swenshuai.xi    marked with __THROW.  */
398*53ee8cc1Swenshuai.xi extern struct tm *getdate (__const char *__string);
399*53ee8cc1Swenshuai.xi # endif
400*53ee8cc1Swenshuai.xi 
401*53ee8cc1Swenshuai.xi # ifdef __USE_GNU
402*53ee8cc1Swenshuai.xi /* Since `getdate' is not reentrant because of the use of `getdate_err'
403*53ee8cc1Swenshuai.xi    and the static buffer to return the result in, we provide a thread-safe
404*53ee8cc1Swenshuai.xi    variant.  The functionality is the same.  The result is returned in
405*53ee8cc1Swenshuai.xi    the buffer pointed to by RESBUFP and in case of an error the return
406*53ee8cc1Swenshuai.xi    value is != 0 with the same values as given above for `getdate_err'.
407*53ee8cc1Swenshuai.xi 
408*53ee8cc1Swenshuai.xi    This function is not part of POSIX and therefore no official
409*53ee8cc1Swenshuai.xi    cancellation point.  But due to similarity with an POSIX interface
410*53ee8cc1Swenshuai.xi    or due to the implementation it is a cancellation point and
411*53ee8cc1Swenshuai.xi    therefore not marked with __THROW.  */
412*53ee8cc1Swenshuai.xi extern int getdate_r (__const char *__restrict __string,
413*53ee8cc1Swenshuai.xi 		      struct tm *__restrict __resbufp);
414*53ee8cc1Swenshuai.xi # endif
415*53ee8cc1Swenshuai.xi 
416*53ee8cc1Swenshuai.xi __END_DECLS
417*53ee8cc1Swenshuai.xi 
418*53ee8cc1Swenshuai.xi #endif /* <time.h> included.  */
419*53ee8cc1Swenshuai.xi 
420*53ee8cc1Swenshuai.xi #endif /* <time.h> not already included.  */
421