xref: /illumos-gate/usr/src/head/time.h (revision 7c478bd9)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*	Copyright (c) 1988 AT&T	*/
23*7c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
24*7c478bd9Sstevel@tonic-gate 
25*7c478bd9Sstevel@tonic-gate 
26*7c478bd9Sstevel@tonic-gate /*
27*7c478bd9Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
28*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
29*7c478bd9Sstevel@tonic-gate  */
30*7c478bd9Sstevel@tonic-gate 
31*7c478bd9Sstevel@tonic-gate #ifndef _TIME_H
32*7c478bd9Sstevel@tonic-gate #define	_TIME_H
33*7c478bd9Sstevel@tonic-gate 
34*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"	/* SVr4.0 1.18 */
35*7c478bd9Sstevel@tonic-gate 
36*7c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h>
37*7c478bd9Sstevel@tonic-gate #include <iso/time_iso.h>
38*7c478bd9Sstevel@tonic-gate #if (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
39*7c478bd9Sstevel@tonic-gate 	(_POSIX_C_SOURCE > 2) || defined(__EXTENSIONS__)
40*7c478bd9Sstevel@tonic-gate #include <sys/types.h>
41*7c478bd9Sstevel@tonic-gate #include <sys/time_impl.h>
42*7c478bd9Sstevel@tonic-gate #endif /* (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) ... */
43*7c478bd9Sstevel@tonic-gate 
44*7c478bd9Sstevel@tonic-gate /*
45*7c478bd9Sstevel@tonic-gate  * Allow global visibility for symbols defined in
46*7c478bd9Sstevel@tonic-gate  * C++ "std" namespace in <iso/time_iso.h>.
47*7c478bd9Sstevel@tonic-gate  */
48*7c478bd9Sstevel@tonic-gate #if __cplusplus >= 199711L
49*7c478bd9Sstevel@tonic-gate using std::size_t;
50*7c478bd9Sstevel@tonic-gate using std::clock_t;
51*7c478bd9Sstevel@tonic-gate using std::time_t;
52*7c478bd9Sstevel@tonic-gate using std::tm;
53*7c478bd9Sstevel@tonic-gate using std::asctime;
54*7c478bd9Sstevel@tonic-gate using std::clock;
55*7c478bd9Sstevel@tonic-gate using std::ctime;
56*7c478bd9Sstevel@tonic-gate using std::difftime;
57*7c478bd9Sstevel@tonic-gate using std::gmtime;
58*7c478bd9Sstevel@tonic-gate using std::localtime;
59*7c478bd9Sstevel@tonic-gate using std::mktime;
60*7c478bd9Sstevel@tonic-gate using std::time;
61*7c478bd9Sstevel@tonic-gate using std::strftime;
62*7c478bd9Sstevel@tonic-gate #endif
63*7c478bd9Sstevel@tonic-gate 
64*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
65*7c478bd9Sstevel@tonic-gate extern "C" {
66*7c478bd9Sstevel@tonic-gate #endif
67*7c478bd9Sstevel@tonic-gate 
68*7c478bd9Sstevel@tonic-gate #ifndef _CLOCKID_T
69*7c478bd9Sstevel@tonic-gate #define	_CLOCKID_T
70*7c478bd9Sstevel@tonic-gate typedef int	clockid_t;
71*7c478bd9Sstevel@tonic-gate #endif
72*7c478bd9Sstevel@tonic-gate 
73*7c478bd9Sstevel@tonic-gate #ifndef _TIMER_T
74*7c478bd9Sstevel@tonic-gate #define	_TIMER_T
75*7c478bd9Sstevel@tonic-gate typedef int	timer_t;
76*7c478bd9Sstevel@tonic-gate #endif
77*7c478bd9Sstevel@tonic-gate 
78*7c478bd9Sstevel@tonic-gate #if defined(__STDC__)
79*7c478bd9Sstevel@tonic-gate 
80*7c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || \
81*7c478bd9Sstevel@tonic-gate 	(!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
82*7c478bd9Sstevel@tonic-gate 	(_POSIX_C_SOURCE - 0 >= 199506L) || defined(_REENTRANT)
83*7c478bd9Sstevel@tonic-gate extern struct tm *gmtime_r(const time_t *_RESTRICT_KYWD,
84*7c478bd9Sstevel@tonic-gate 			struct tm *_RESTRICT_KYWD);
85*7c478bd9Sstevel@tonic-gate extern struct tm *localtime_r(const time_t *_RESTRICT_KYWD,
86*7c478bd9Sstevel@tonic-gate 			struct tm *_RESTRICT_KYWD);
87*7c478bd9Sstevel@tonic-gate #endif
88*7c478bd9Sstevel@tonic-gate 
89*7c478bd9Sstevel@tonic-gate #if (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
90*7c478bd9Sstevel@tonic-gate 	defined(_XPG4) || defined(__EXTENSIONS__)
91*7c478bd9Sstevel@tonic-gate 
92*7c478bd9Sstevel@tonic-gate #ifdef _STRPTIME_DONTZERO
93*7c478bd9Sstevel@tonic-gate #ifdef __PRAGMA_REDEFINE_EXTNAME
94*7c478bd9Sstevel@tonic-gate #pragma	redefine_extname strptime __strptime_dontzero
95*7c478bd9Sstevel@tonic-gate #else	/* __PRAGMA_REDEFINE_EXTNAME */
96*7c478bd9Sstevel@tonic-gate extern char *__strptime_dontzero(const char *, const char *, struct tm *);
97*7c478bd9Sstevel@tonic-gate #define	strptime	__strptime_dontzero
98*7c478bd9Sstevel@tonic-gate #endif	/* __PRAGMA_REDEFINE_EXTNAME */
99*7c478bd9Sstevel@tonic-gate #endif	/* _STRPTIME_DONTZERO */
100*7c478bd9Sstevel@tonic-gate 
101*7c478bd9Sstevel@tonic-gate extern char *strptime(const char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD,
102*7c478bd9Sstevel@tonic-gate 		struct tm *_RESTRICT_KYWD);
103*7c478bd9Sstevel@tonic-gate 
104*7c478bd9Sstevel@tonic-gate #endif /* (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))... */
105*7c478bd9Sstevel@tonic-gate 
106*7c478bd9Sstevel@tonic-gate #if (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
107*7c478bd9Sstevel@tonic-gate 	(_POSIX_C_SOURCE > 2) || defined(__EXTENSIONS__)
108*7c478bd9Sstevel@tonic-gate /*
109*7c478bd9Sstevel@tonic-gate  * Neither X/Open nor POSIX allow the inclusion of <signal.h> for the
110*7c478bd9Sstevel@tonic-gate  * definition of the sigevent structure.  Both require the inclusion
111*7c478bd9Sstevel@tonic-gate  * of <signal.h> and <time.h> when using the timer_create() function.
112*7c478bd9Sstevel@tonic-gate  * However, X/Open also specifies that the sigevent structure be defined
113*7c478bd9Sstevel@tonic-gate  * in <time.h> as described in the header <signal.h>.  This prevents
114*7c478bd9Sstevel@tonic-gate  * compiler warnings for applications that only include <time.h> and not
115*7c478bd9Sstevel@tonic-gate  * also <signal.h>.  The sigval union and the sigevent structure is
116*7c478bd9Sstevel@tonic-gate  * therefore defined both here and in <sys/siginfo.h> which gets included
117*7c478bd9Sstevel@tonic-gate  * via inclusion of <signal.h>.
118*7c478bd9Sstevel@tonic-gate  */
119*7c478bd9Sstevel@tonic-gate #ifndef	_SIGVAL
120*7c478bd9Sstevel@tonic-gate #define	_SIGVAL
121*7c478bd9Sstevel@tonic-gate union sigval {
122*7c478bd9Sstevel@tonic-gate 	int	sival_int;	/* integer value */
123*7c478bd9Sstevel@tonic-gate 	void	*sival_ptr;	/* pointer value */
124*7c478bd9Sstevel@tonic-gate };
125*7c478bd9Sstevel@tonic-gate #endif	/* _SIGVAL */
126*7c478bd9Sstevel@tonic-gate 
127*7c478bd9Sstevel@tonic-gate #ifndef	_SIGEVENT
128*7c478bd9Sstevel@tonic-gate #define	_SIGEVENT
129*7c478bd9Sstevel@tonic-gate struct sigevent {
130*7c478bd9Sstevel@tonic-gate 	int		sigev_notify;	/* notification mode */
131*7c478bd9Sstevel@tonic-gate 	int		sigev_signo;	/* signal number */
132*7c478bd9Sstevel@tonic-gate 	union sigval	sigev_value;	/* signal value */
133*7c478bd9Sstevel@tonic-gate 	void		(*sigev_notify_function)(union sigval);
134*7c478bd9Sstevel@tonic-gate 	pthread_attr_t	*sigev_notify_attributes;
135*7c478bd9Sstevel@tonic-gate 	int		__sigev_pad2;
136*7c478bd9Sstevel@tonic-gate };
137*7c478bd9Sstevel@tonic-gate #endif	/* _SIGEVENT */
138*7c478bd9Sstevel@tonic-gate 
139*7c478bd9Sstevel@tonic-gate extern int clock_getres(clockid_t, struct timespec *);
140*7c478bd9Sstevel@tonic-gate extern int clock_gettime(clockid_t, struct timespec *);
141*7c478bd9Sstevel@tonic-gate extern int clock_settime(clockid_t, const struct timespec *);
142*7c478bd9Sstevel@tonic-gate extern int timer_create(clockid_t, struct sigevent *_RESTRICT_KYWD,
143*7c478bd9Sstevel@tonic-gate 		timer_t *_RESTRICT_KYWD);
144*7c478bd9Sstevel@tonic-gate extern int timer_delete(timer_t);
145*7c478bd9Sstevel@tonic-gate extern int timer_getoverrun(timer_t);
146*7c478bd9Sstevel@tonic-gate extern int timer_gettime(timer_t, struct itimerspec *);
147*7c478bd9Sstevel@tonic-gate extern int timer_settime(timer_t, int, const struct itimerspec *_RESTRICT_KYWD,
148*7c478bd9Sstevel@tonic-gate 		struct itimerspec *_RESTRICT_KYWD);
149*7c478bd9Sstevel@tonic-gate 
150*7c478bd9Sstevel@tonic-gate extern int nanosleep(const struct timespec *, struct timespec *);
151*7c478bd9Sstevel@tonic-gate extern int clock_nanosleep(clockid_t, int,
152*7c478bd9Sstevel@tonic-gate 	const struct timespec *, struct timespec *);
153*7c478bd9Sstevel@tonic-gate 
154*7c478bd9Sstevel@tonic-gate #endif /* (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))... */
155*7c478bd9Sstevel@tonic-gate 
156*7c478bd9Sstevel@tonic-gate #if !defined(_STRICT_STDC) || defined(__XOPEN_OR_POSIX) || \
157*7c478bd9Sstevel@tonic-gate 	defined(__EXTENSIONS__)
158*7c478bd9Sstevel@tonic-gate 
159*7c478bd9Sstevel@tonic-gate extern void tzset(void);
160*7c478bd9Sstevel@tonic-gate extern char *tzname[2];
161*7c478bd9Sstevel@tonic-gate 
162*7c478bd9Sstevel@tonic-gate /* CLK_TCK marked as LEGACY in SUSv2 and removed in SUSv3 */
163*7c478bd9Sstevel@tonic-gate #if !defined(_XPG6) || defined(__EXTENSIONS__)
164*7c478bd9Sstevel@tonic-gate #ifndef CLK_TCK
165*7c478bd9Sstevel@tonic-gate extern long _sysconf(int);	/* System Private interface to sysconf() */
166*7c478bd9Sstevel@tonic-gate #define	CLK_TCK	((clock_t)_sysconf(3))	/* clock ticks per second */
167*7c478bd9Sstevel@tonic-gate 				/* 3 is _SC_CLK_TCK */
168*7c478bd9Sstevel@tonic-gate #endif
169*7c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG6) || defined(__EXTENSIONS__) */
170*7c478bd9Sstevel@tonic-gate 
171*7c478bd9Sstevel@tonic-gate #if (!defined(_STRICT_STDC) && !defined(_POSIX_C_SOURCE)) || \
172*7c478bd9Sstevel@tonic-gate 	defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__)
173*7c478bd9Sstevel@tonic-gate extern long timezone;
174*7c478bd9Sstevel@tonic-gate extern int daylight;
175*7c478bd9Sstevel@tonic-gate #endif
176*7c478bd9Sstevel@tonic-gate 
177*7c478bd9Sstevel@tonic-gate #endif /* !defined(_STRICT_STDC) || defined(__XOPEN_OR_POSIX)... */
178*7c478bd9Sstevel@tonic-gate 
179*7c478bd9Sstevel@tonic-gate #if (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))
180*7c478bd9Sstevel@tonic-gate extern int cftime(char *, char *, const time_t *);
181*7c478bd9Sstevel@tonic-gate extern int ascftime(char *, const char *, const struct tm *);
182*7c478bd9Sstevel@tonic-gate extern long altzone;
183*7c478bd9Sstevel@tonic-gate #endif
184*7c478bd9Sstevel@tonic-gate 
185*7c478bd9Sstevel@tonic-gate #if (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
186*7c478bd9Sstevel@tonic-gate 	defined(_XPG4_2) || defined(__EXTENSIONS__)
187*7c478bd9Sstevel@tonic-gate extern struct tm *getdate(const char *);
188*7c478bd9Sstevel@tonic-gate #ifdef	_REENTRANT
189*7c478bd9Sstevel@tonic-gate #undef getdate_err
190*7c478bd9Sstevel@tonic-gate #define	getdate_err *(int *)_getdate_err_addr()
191*7c478bd9Sstevel@tonic-gate extern int *_getdate_err_addr(void);
192*7c478bd9Sstevel@tonic-gate #else
193*7c478bd9Sstevel@tonic-gate extern int getdate_err;
194*7c478bd9Sstevel@tonic-gate #endif /* _REENTRANT */
195*7c478bd9Sstevel@tonic-gate #endif /* (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))... */
196*7c478bd9Sstevel@tonic-gate 
197*7c478bd9Sstevel@tonic-gate #else /* __STDC__ */
198*7c478bd9Sstevel@tonic-gate 
199*7c478bd9Sstevel@tonic-gate extern int cftime(), ascftime();
200*7c478bd9Sstevel@tonic-gate extern void tzset();
201*7c478bd9Sstevel@tonic-gate 
202*7c478bd9Sstevel@tonic-gate #ifdef _STRPTIME_DONTZERO
203*7c478bd9Sstevel@tonic-gate #ifdef __PRAGMA_REDEFINE_EXTNAME
204*7c478bd9Sstevel@tonic-gate #pragma	redefine_extname strptime	__strptime_dontzero
205*7c478bd9Sstevel@tonic-gate #else	/* __PRAGMA_REDEFINE_EXTNAME */
206*7c478bd9Sstevel@tonic-gate extern char *__strptime_dontzero();
207*7c478bd9Sstevel@tonic-gate #define	strptime	__strptime_dontzero
208*7c478bd9Sstevel@tonic-gate #endif	/* __PRAGMA_REDEFINE_EXTNAME */
209*7c478bd9Sstevel@tonic-gate #endif	/* _STRPTIME_DONTZERO */
210*7c478bd9Sstevel@tonic-gate 
211*7c478bd9Sstevel@tonic-gate extern char *strptime();
212*7c478bd9Sstevel@tonic-gate 
213*7c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || \
214*7c478bd9Sstevel@tonic-gate 	(!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
215*7c478bd9Sstevel@tonic-gate 	(_POSIX_C_SOURCE - 0 >= 199506L) || defined(_REENTRANT)
216*7c478bd9Sstevel@tonic-gate extern struct tm *gmtime_r();
217*7c478bd9Sstevel@tonic-gate extern struct tm *localtime_r();
218*7c478bd9Sstevel@tonic-gate #endif
219*7c478bd9Sstevel@tonic-gate 
220*7c478bd9Sstevel@tonic-gate extern long timezone, altzone;
221*7c478bd9Sstevel@tonic-gate extern int daylight;
222*7c478bd9Sstevel@tonic-gate extern char *tzname[2];
223*7c478bd9Sstevel@tonic-gate 
224*7c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
225*7c478bd9Sstevel@tonic-gate extern struct tm *getdate();
226*7c478bd9Sstevel@tonic-gate #ifdef	_REENTRANT
227*7c478bd9Sstevel@tonic-gate #undef getdate_err
228*7c478bd9Sstevel@tonic-gate #define	getdate_err *(int *)_getdate_err_addr()
229*7c478bd9Sstevel@tonic-gate extern int *_getdate_err_addr();
230*7c478bd9Sstevel@tonic-gate #else
231*7c478bd9Sstevel@tonic-gate extern int getdate_err;
232*7c478bd9Sstevel@tonic-gate #endif /* _REENTRANT */
233*7c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
234*7c478bd9Sstevel@tonic-gate 
235*7c478bd9Sstevel@tonic-gate #endif	/* __STDC__ */
236*7c478bd9Sstevel@tonic-gate 
237*7c478bd9Sstevel@tonic-gate /*
238*7c478bd9Sstevel@tonic-gate  * ctime_r() & asctime_r() prototypes are defined here.
239*7c478bd9Sstevel@tonic-gate  */
240*7c478bd9Sstevel@tonic-gate 
241*7c478bd9Sstevel@tonic-gate /*
242*7c478bd9Sstevel@tonic-gate  * Previous releases of Solaris, starting at 2.3, provided definitions of
243*7c478bd9Sstevel@tonic-gate  * various functions as specified in POSIX.1c, Draft 6.  For some of these
244*7c478bd9Sstevel@tonic-gate  * functions, the final POSIX 1003.1c standard had a different number of
245*7c478bd9Sstevel@tonic-gate  * arguments and return values.
246*7c478bd9Sstevel@tonic-gate  *
247*7c478bd9Sstevel@tonic-gate  * The following segment of this header provides support for the standard
248*7c478bd9Sstevel@tonic-gate  * interfaces while supporting applications written under earlier
249*7c478bd9Sstevel@tonic-gate  * releases.  The application defines appropriate values of the feature
250*7c478bd9Sstevel@tonic-gate  * test macros _POSIX_C_SOURCE and _POSIX_PTHREAD_SEMANTICS to indicate
251*7c478bd9Sstevel@tonic-gate  * whether it was written to expect the Draft 6 or standard versions of
252*7c478bd9Sstevel@tonic-gate  * these interfaces, before including this header.  This header then
253*7c478bd9Sstevel@tonic-gate  * provides a mapping from the source version of the interface to an
254*7c478bd9Sstevel@tonic-gate  * appropriate binary interface.  Such mappings permit an application
255*7c478bd9Sstevel@tonic-gate  * to be built from libraries and objects which have mixed expectations
256*7c478bd9Sstevel@tonic-gate  * of the definitions of these functions.
257*7c478bd9Sstevel@tonic-gate  *
258*7c478bd9Sstevel@tonic-gate  * For applications using the Draft 6 definitions, the binary symbol is the
259*7c478bd9Sstevel@tonic-gate  * same as the source symbol, and no explicit mapping is needed.  For the
260*7c478bd9Sstevel@tonic-gate  * standard interface, the function func() is mapped to the binary symbol
261*7c478bd9Sstevel@tonic-gate  * _posix_func().  The preferred mechanism for the remapping is a compiler
262*7c478bd9Sstevel@tonic-gate  * #pragma.  If the compiler does not provide such a #pragma, the header file
263*7c478bd9Sstevel@tonic-gate  * defines a static function func() which calls the _posix_func() version;
264*7c478bd9Sstevel@tonic-gate  * this has to be done instead of #define since POSIX specifies that an
265*7c478bd9Sstevel@tonic-gate  * application can #undef the symbol and still be bound to the correct
266*7c478bd9Sstevel@tonic-gate  * implementation.  Unfortunately, the statics confuse lint so we fallback to
267*7c478bd9Sstevel@tonic-gate  * #define in that case.
268*7c478bd9Sstevel@tonic-gate  *
269*7c478bd9Sstevel@tonic-gate  * NOTE: Support for the Draft 6 definitions is provided for compatibility
270*7c478bd9Sstevel@tonic-gate  * only.  New applications/libraries should use the standard definitions.
271*7c478bd9Sstevel@tonic-gate  */
272*7c478bd9Sstevel@tonic-gate 
273*7c478bd9Sstevel@tonic-gate #if	defined(__EXTENSIONS__) || defined(_REENTRANT) || \
274*7c478bd9Sstevel@tonic-gate 	(!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
275*7c478bd9Sstevel@tonic-gate 	(_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
276*7c478bd9Sstevel@tonic-gate 
277*7c478bd9Sstevel@tonic-gate #if	defined(__STDC__)
278*7c478bd9Sstevel@tonic-gate 
279*7c478bd9Sstevel@tonic-gate #if	(_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
280*7c478bd9Sstevel@tonic-gate 
281*7c478bd9Sstevel@tonic-gate #ifdef __PRAGMA_REDEFINE_EXTNAME
282*7c478bd9Sstevel@tonic-gate #pragma redefine_extname ctime_r __posix_ctime_r
283*7c478bd9Sstevel@tonic-gate #pragma redefine_extname asctime_r __posix_asctime_r
284*7c478bd9Sstevel@tonic-gate extern char *asctime_r(const struct tm *_RESTRICT_KYWD, char *_RESTRICT_KYWD);
285*7c478bd9Sstevel@tonic-gate extern char *ctime_r(const time_t *, char *);
286*7c478bd9Sstevel@tonic-gate #else  /* __PRAGMA_REDEFINE_EXTNAME */
287*7c478bd9Sstevel@tonic-gate 
288*7c478bd9Sstevel@tonic-gate extern char *__posix_asctime_r(const struct tm *_RESTRICT_KYWD,
289*7c478bd9Sstevel@tonic-gate     char *_RESTRICT_KYWD);
290*7c478bd9Sstevel@tonic-gate extern char *__posix_ctime_r(const time_t *, char *);
291*7c478bd9Sstevel@tonic-gate 
292*7c478bd9Sstevel@tonic-gate #ifdef	__lint
293*7c478bd9Sstevel@tonic-gate 
294*7c478bd9Sstevel@tonic-gate #define	ctime_r __posix_ctime_r
295*7c478bd9Sstevel@tonic-gate #define	asctime_r __posix_asctime_r
296*7c478bd9Sstevel@tonic-gate 
297*7c478bd9Sstevel@tonic-gate #else	/* !__lint */
298*7c478bd9Sstevel@tonic-gate 
299*7c478bd9Sstevel@tonic-gate static char *
300*7c478bd9Sstevel@tonic-gate asctime_r(const struct tm *_RESTRICT_KYWD __tm, char *_RESTRICT_KYWD __buf)
301*7c478bd9Sstevel@tonic-gate {
302*7c478bd9Sstevel@tonic-gate 	return (__posix_asctime_r(__tm, __buf));
303*7c478bd9Sstevel@tonic-gate }
304*7c478bd9Sstevel@tonic-gate 
305*7c478bd9Sstevel@tonic-gate static char *
306*7c478bd9Sstevel@tonic-gate ctime_r(const time_t *__time, char *__buf)
307*7c478bd9Sstevel@tonic-gate {
308*7c478bd9Sstevel@tonic-gate 	return (__posix_ctime_r(__time, __buf));
309*7c478bd9Sstevel@tonic-gate }
310*7c478bd9Sstevel@tonic-gate 
311*7c478bd9Sstevel@tonic-gate #endif /* !__lint */
312*7c478bd9Sstevel@tonic-gate #endif /* __PRAGMA_REDEFINE_EXTNAME */
313*7c478bd9Sstevel@tonic-gate 
314*7c478bd9Sstevel@tonic-gate #else  /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
315*7c478bd9Sstevel@tonic-gate 
316*7c478bd9Sstevel@tonic-gate extern char *asctime_r(const struct tm *, char *, int);
317*7c478bd9Sstevel@tonic-gate extern char *ctime_r(const time_t *, char *, int);
318*7c478bd9Sstevel@tonic-gate 
319*7c478bd9Sstevel@tonic-gate #endif  /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
320*7c478bd9Sstevel@tonic-gate 
321*7c478bd9Sstevel@tonic-gate #else  /* __STDC__ */
322*7c478bd9Sstevel@tonic-gate 
323*7c478bd9Sstevel@tonic-gate #if	(_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
324*7c478bd9Sstevel@tonic-gate 
325*7c478bd9Sstevel@tonic-gate #ifdef __PRAGMA_REDEFINE_EXTNAME
326*7c478bd9Sstevel@tonic-gate #pragma redefine_extname asctime_r __posix_asctime_r
327*7c478bd9Sstevel@tonic-gate #pragma redefine_extname ctime_r __posix_ctime_r
328*7c478bd9Sstevel@tonic-gate extern char *asctime_r();
329*7c478bd9Sstevel@tonic-gate extern char *ctime_r();
330*7c478bd9Sstevel@tonic-gate #else  /* __PRAGMA_REDEFINE_EXTNAME */
331*7c478bd9Sstevel@tonic-gate 
332*7c478bd9Sstevel@tonic-gate extern char *__posix_asctime_r();
333*7c478bd9Sstevel@tonic-gate extern char *__posix_ctime_r();
334*7c478bd9Sstevel@tonic-gate 
335*7c478bd9Sstevel@tonic-gate #ifdef	__lint
336*7c478bd9Sstevel@tonic-gate 
337*7c478bd9Sstevel@tonic-gate #define	asctime_r __posix_asctime_r
338*7c478bd9Sstevel@tonic-gate #define	ctime_r __posix_ctime_r
339*7c478bd9Sstevel@tonic-gate 
340*7c478bd9Sstevel@tonic-gate #else	/* !__lint */
341*7c478bd9Sstevel@tonic-gate 
342*7c478bd9Sstevel@tonic-gate static char *
343*7c478bd9Sstevel@tonic-gate asctime_r(__tm, __buf)
344*7c478bd9Sstevel@tonic-gate 	struct tm *__tm;
345*7c478bd9Sstevel@tonic-gate 	char *__buf;
346*7c478bd9Sstevel@tonic-gate {
347*7c478bd9Sstevel@tonic-gate 	return (__posix_asctime_r(__tm, __buf));
348*7c478bd9Sstevel@tonic-gate }
349*7c478bd9Sstevel@tonic-gate static char *
350*7c478bd9Sstevel@tonic-gate ctime_r(__time, __buf)
351*7c478bd9Sstevel@tonic-gate 	time_t *__time;
352*7c478bd9Sstevel@tonic-gate 	char *__buf;
353*7c478bd9Sstevel@tonic-gate {
354*7c478bd9Sstevel@tonic-gate 	return (__posix_ctime_r(__time, __buf));
355*7c478bd9Sstevel@tonic-gate }
356*7c478bd9Sstevel@tonic-gate 
357*7c478bd9Sstevel@tonic-gate #endif /* !__lint */
358*7c478bd9Sstevel@tonic-gate #endif /* __PRAGMA_REDEFINE_EXTNAME */
359*7c478bd9Sstevel@tonic-gate 
360*7c478bd9Sstevel@tonic-gate #else  /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
361*7c478bd9Sstevel@tonic-gate 
362*7c478bd9Sstevel@tonic-gate extern char *asctime_r();
363*7c478bd9Sstevel@tonic-gate extern char *ctime_r();
364*7c478bd9Sstevel@tonic-gate 
365*7c478bd9Sstevel@tonic-gate #endif /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
366*7c478bd9Sstevel@tonic-gate 
367*7c478bd9Sstevel@tonic-gate #endif /* __STDC__ */
368*7c478bd9Sstevel@tonic-gate 
369*7c478bd9Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__) || defined(_REENTRANT)... */
370*7c478bd9Sstevel@tonic-gate 
371*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
372*7c478bd9Sstevel@tonic-gate }
373*7c478bd9Sstevel@tonic-gate #endif
374*7c478bd9Sstevel@tonic-gate 
375*7c478bd9Sstevel@tonic-gate #endif	/* _TIME_H */
376