xref: /illumos-gate/usr/src/head/time.h (revision 6eaad1d3)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5bfe60e20Sdamico  * Common Development and Distribution License (the "License").
6bfe60e20Sdamico  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*	Copyright (c) 1988 AT&T	*/
227c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
237c478bd9Sstevel@tonic-gate 
247c478bd9Sstevel@tonic-gate 
257c478bd9Sstevel@tonic-gate /*
26bfe60e20Sdamico  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
277c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
287c478bd9Sstevel@tonic-gate  */
29*6eaad1d3SGarrett D'Amore /*
30*6eaad1d3SGarrett D'Amore  * Copyright 2010 Nexenta Systems, Inc.  Al rights reserved.
31*6eaad1d3SGarrett D'Amore  */
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate #ifndef _TIME_H
347c478bd9Sstevel@tonic-gate #define	_TIME_H
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h>
377c478bd9Sstevel@tonic-gate #include <iso/time_iso.h>
387c478bd9Sstevel@tonic-gate #if (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
397c478bd9Sstevel@tonic-gate 	(_POSIX_C_SOURCE > 2) || defined(__EXTENSIONS__)
407c478bd9Sstevel@tonic-gate #include <sys/types.h>
417c478bd9Sstevel@tonic-gate #include <sys/time_impl.h>
427c478bd9Sstevel@tonic-gate #endif /* (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) ... */
437c478bd9Sstevel@tonic-gate 
447c478bd9Sstevel@tonic-gate /*
457c478bd9Sstevel@tonic-gate  * Allow global visibility for symbols defined in
467c478bd9Sstevel@tonic-gate  * C++ "std" namespace in <iso/time_iso.h>.
477c478bd9Sstevel@tonic-gate  */
487c478bd9Sstevel@tonic-gate #if __cplusplus >= 199711L
497c478bd9Sstevel@tonic-gate using std::size_t;
507c478bd9Sstevel@tonic-gate using std::clock_t;
517c478bd9Sstevel@tonic-gate using std::time_t;
527c478bd9Sstevel@tonic-gate using std::tm;
537c478bd9Sstevel@tonic-gate using std::asctime;
547c478bd9Sstevel@tonic-gate using std::clock;
557c478bd9Sstevel@tonic-gate using std::ctime;
567c478bd9Sstevel@tonic-gate using std::difftime;
577c478bd9Sstevel@tonic-gate using std::gmtime;
587c478bd9Sstevel@tonic-gate using std::localtime;
597c478bd9Sstevel@tonic-gate using std::mktime;
607c478bd9Sstevel@tonic-gate using std::time;
617c478bd9Sstevel@tonic-gate using std::strftime;
627c478bd9Sstevel@tonic-gate #endif
637c478bd9Sstevel@tonic-gate 
647c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
657c478bd9Sstevel@tonic-gate extern "C" {
667c478bd9Sstevel@tonic-gate #endif
677c478bd9Sstevel@tonic-gate 
687c478bd9Sstevel@tonic-gate #ifndef _CLOCKID_T
697c478bd9Sstevel@tonic-gate #define	_CLOCKID_T
707c478bd9Sstevel@tonic-gate typedef int	clockid_t;
717c478bd9Sstevel@tonic-gate #endif
727c478bd9Sstevel@tonic-gate 
737c478bd9Sstevel@tonic-gate #ifndef _TIMER_T
747c478bd9Sstevel@tonic-gate #define	_TIMER_T
757c478bd9Sstevel@tonic-gate typedef int	timer_t;
767c478bd9Sstevel@tonic-gate #endif
777c478bd9Sstevel@tonic-gate 
787c478bd9Sstevel@tonic-gate #if defined(__STDC__)
797c478bd9Sstevel@tonic-gate 
807c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || \
817c478bd9Sstevel@tonic-gate 	(!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
827c478bd9Sstevel@tonic-gate 	(_POSIX_C_SOURCE - 0 >= 199506L) || defined(_REENTRANT)
837c478bd9Sstevel@tonic-gate extern struct tm *gmtime_r(const time_t *_RESTRICT_KYWD,
847c478bd9Sstevel@tonic-gate 			struct tm *_RESTRICT_KYWD);
857c478bd9Sstevel@tonic-gate extern struct tm *localtime_r(const time_t *_RESTRICT_KYWD,
867c478bd9Sstevel@tonic-gate 			struct tm *_RESTRICT_KYWD);
877c478bd9Sstevel@tonic-gate #endif
887c478bd9Sstevel@tonic-gate 
897c478bd9Sstevel@tonic-gate #if (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
907c478bd9Sstevel@tonic-gate 	defined(_XPG4) || defined(__EXTENSIONS__)
917c478bd9Sstevel@tonic-gate 
927c478bd9Sstevel@tonic-gate #ifdef _STRPTIME_DONTZERO
937c478bd9Sstevel@tonic-gate #ifdef __PRAGMA_REDEFINE_EXTNAME
947c478bd9Sstevel@tonic-gate #pragma	redefine_extname strptime __strptime_dontzero
957c478bd9Sstevel@tonic-gate #else	/* __PRAGMA_REDEFINE_EXTNAME */
967c478bd9Sstevel@tonic-gate extern char *__strptime_dontzero(const char *, const char *, struct tm *);
977c478bd9Sstevel@tonic-gate #define	strptime	__strptime_dontzero
987c478bd9Sstevel@tonic-gate #endif	/* __PRAGMA_REDEFINE_EXTNAME */
997c478bd9Sstevel@tonic-gate #endif	/* _STRPTIME_DONTZERO */
1007c478bd9Sstevel@tonic-gate 
1017c478bd9Sstevel@tonic-gate extern char *strptime(const char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD,
1027c478bd9Sstevel@tonic-gate 		struct tm *_RESTRICT_KYWD);
1037c478bd9Sstevel@tonic-gate 
1047c478bd9Sstevel@tonic-gate #endif /* (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))... */
1057c478bd9Sstevel@tonic-gate 
1067c478bd9Sstevel@tonic-gate #if (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
1077c478bd9Sstevel@tonic-gate 	(_POSIX_C_SOURCE > 2) || defined(__EXTENSIONS__)
1087c478bd9Sstevel@tonic-gate /*
1097c478bd9Sstevel@tonic-gate  * Neither X/Open nor POSIX allow the inclusion of <signal.h> for the
1107c478bd9Sstevel@tonic-gate  * definition of the sigevent structure.  Both require the inclusion
1117c478bd9Sstevel@tonic-gate  * of <signal.h> and <time.h> when using the timer_create() function.
1127c478bd9Sstevel@tonic-gate  * However, X/Open also specifies that the sigevent structure be defined
1137c478bd9Sstevel@tonic-gate  * in <time.h> as described in the header <signal.h>.  This prevents
1147c478bd9Sstevel@tonic-gate  * compiler warnings for applications that only include <time.h> and not
1157c478bd9Sstevel@tonic-gate  * also <signal.h>.  The sigval union and the sigevent structure is
1167c478bd9Sstevel@tonic-gate  * therefore defined both here and in <sys/siginfo.h> which gets included
1177c478bd9Sstevel@tonic-gate  * via inclusion of <signal.h>.
1187c478bd9Sstevel@tonic-gate  */
1197c478bd9Sstevel@tonic-gate #ifndef	_SIGVAL
1207c478bd9Sstevel@tonic-gate #define	_SIGVAL
1217c478bd9Sstevel@tonic-gate union sigval {
1227c478bd9Sstevel@tonic-gate 	int	sival_int;	/* integer value */
1237c478bd9Sstevel@tonic-gate 	void	*sival_ptr;	/* pointer value */
1247c478bd9Sstevel@tonic-gate };
1257c478bd9Sstevel@tonic-gate #endif	/* _SIGVAL */
1267c478bd9Sstevel@tonic-gate 
1277c478bd9Sstevel@tonic-gate #ifndef	_SIGEVENT
1287c478bd9Sstevel@tonic-gate #define	_SIGEVENT
1297c478bd9Sstevel@tonic-gate struct sigevent {
1307c478bd9Sstevel@tonic-gate 	int		sigev_notify;	/* notification mode */
1317c478bd9Sstevel@tonic-gate 	int		sigev_signo;	/* signal number */
1327c478bd9Sstevel@tonic-gate 	union sigval	sigev_value;	/* signal value */
1337c478bd9Sstevel@tonic-gate 	void		(*sigev_notify_function)(union sigval);
1347c478bd9Sstevel@tonic-gate 	pthread_attr_t	*sigev_notify_attributes;
1357c478bd9Sstevel@tonic-gate 	int		__sigev_pad2;
1367c478bd9Sstevel@tonic-gate };
1377c478bd9Sstevel@tonic-gate #endif	/* _SIGEVENT */
1387c478bd9Sstevel@tonic-gate 
1397c478bd9Sstevel@tonic-gate extern int clock_getres(clockid_t, struct timespec *);
1407c478bd9Sstevel@tonic-gate extern int clock_gettime(clockid_t, struct timespec *);
1417c478bd9Sstevel@tonic-gate extern int clock_settime(clockid_t, const struct timespec *);
1427c478bd9Sstevel@tonic-gate extern int timer_create(clockid_t, struct sigevent *_RESTRICT_KYWD,
1437c478bd9Sstevel@tonic-gate 		timer_t *_RESTRICT_KYWD);
1447c478bd9Sstevel@tonic-gate extern int timer_delete(timer_t);
1457c478bd9Sstevel@tonic-gate extern int timer_getoverrun(timer_t);
1467c478bd9Sstevel@tonic-gate extern int timer_gettime(timer_t, struct itimerspec *);
1477c478bd9Sstevel@tonic-gate extern int timer_settime(timer_t, int, const struct itimerspec *_RESTRICT_KYWD,
1487c478bd9Sstevel@tonic-gate 		struct itimerspec *_RESTRICT_KYWD);
1497c478bd9Sstevel@tonic-gate 
1507c478bd9Sstevel@tonic-gate extern int nanosleep(const struct timespec *, struct timespec *);
1517c478bd9Sstevel@tonic-gate extern int clock_nanosleep(clockid_t, int,
1527c478bd9Sstevel@tonic-gate 	const struct timespec *, struct timespec *);
1537c478bd9Sstevel@tonic-gate 
1547c478bd9Sstevel@tonic-gate #endif /* (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))... */
1557c478bd9Sstevel@tonic-gate 
1567c478bd9Sstevel@tonic-gate #if !defined(_STRICT_STDC) || defined(__XOPEN_OR_POSIX) || \
1577c478bd9Sstevel@tonic-gate 	defined(__EXTENSIONS__)
1587c478bd9Sstevel@tonic-gate 
1597c478bd9Sstevel@tonic-gate extern void tzset(void);
1607c478bd9Sstevel@tonic-gate extern char *tzname[2];
1617c478bd9Sstevel@tonic-gate 
1627c478bd9Sstevel@tonic-gate /* CLK_TCK marked as LEGACY in SUSv2 and removed in SUSv3 */
1637c478bd9Sstevel@tonic-gate #if !defined(_XPG6) || defined(__EXTENSIONS__)
1647c478bd9Sstevel@tonic-gate #ifndef CLK_TCK
1657c478bd9Sstevel@tonic-gate extern long _sysconf(int);	/* System Private interface to sysconf() */
1667c478bd9Sstevel@tonic-gate #define	CLK_TCK	((clock_t)_sysconf(3))	/* clock ticks per second */
1677c478bd9Sstevel@tonic-gate 				/* 3 is _SC_CLK_TCK */
1687c478bd9Sstevel@tonic-gate #endif
1697c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG6) || defined(__EXTENSIONS__) */
1707c478bd9Sstevel@tonic-gate 
1717c478bd9Sstevel@tonic-gate #if (!defined(_STRICT_STDC) && !defined(_POSIX_C_SOURCE)) || \
1727c478bd9Sstevel@tonic-gate 	defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__)
1737c478bd9Sstevel@tonic-gate extern long timezone;
1747c478bd9Sstevel@tonic-gate extern int daylight;
1757c478bd9Sstevel@tonic-gate #endif
1767c478bd9Sstevel@tonic-gate 
1777c478bd9Sstevel@tonic-gate #endif /* !defined(_STRICT_STDC) || defined(__XOPEN_OR_POSIX)... */
1787c478bd9Sstevel@tonic-gate 
179bfe60e20Sdamico #if (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
180bfe60e20Sdamico 	defined(__EXTENSIONS__)
181*6eaad1d3SGarrett D'Amore extern time_t timegm(struct tm *);
1827c478bd9Sstevel@tonic-gate extern int cftime(char *, char *, const time_t *);
1837c478bd9Sstevel@tonic-gate extern int ascftime(char *, const char *, const struct tm *);
1847c478bd9Sstevel@tonic-gate extern long altzone;
1857c478bd9Sstevel@tonic-gate #endif
1867c478bd9Sstevel@tonic-gate 
1877c478bd9Sstevel@tonic-gate #if (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
1887c478bd9Sstevel@tonic-gate 	defined(_XPG4_2) || defined(__EXTENSIONS__)
1897c478bd9Sstevel@tonic-gate extern struct tm *getdate(const char *);
1907c478bd9Sstevel@tonic-gate #ifdef	_REENTRANT
1917c478bd9Sstevel@tonic-gate #undef getdate_err
1927c478bd9Sstevel@tonic-gate #define	getdate_err *(int *)_getdate_err_addr()
1937c478bd9Sstevel@tonic-gate extern int *_getdate_err_addr(void);
1947c478bd9Sstevel@tonic-gate #else
1957c478bd9Sstevel@tonic-gate extern int getdate_err;
1967c478bd9Sstevel@tonic-gate #endif /* _REENTRANT */
1977c478bd9Sstevel@tonic-gate #endif /* (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))... */
1987c478bd9Sstevel@tonic-gate 
1997c478bd9Sstevel@tonic-gate #else /* __STDC__ */
2007c478bd9Sstevel@tonic-gate 
2017c478bd9Sstevel@tonic-gate extern int cftime(), ascftime();
2027c478bd9Sstevel@tonic-gate extern void tzset();
203*6eaad1d3SGarrett D'Amore extern time_t timegm();
2047c478bd9Sstevel@tonic-gate 
2057c478bd9Sstevel@tonic-gate #ifdef _STRPTIME_DONTZERO
2067c478bd9Sstevel@tonic-gate #ifdef __PRAGMA_REDEFINE_EXTNAME
2077c478bd9Sstevel@tonic-gate #pragma	redefine_extname strptime	__strptime_dontzero
2087c478bd9Sstevel@tonic-gate #else	/* __PRAGMA_REDEFINE_EXTNAME */
2097c478bd9Sstevel@tonic-gate extern char *__strptime_dontzero();
2107c478bd9Sstevel@tonic-gate #define	strptime	__strptime_dontzero
2117c478bd9Sstevel@tonic-gate #endif	/* __PRAGMA_REDEFINE_EXTNAME */
2127c478bd9Sstevel@tonic-gate #endif	/* _STRPTIME_DONTZERO */
2137c478bd9Sstevel@tonic-gate 
2147c478bd9Sstevel@tonic-gate extern char *strptime();
2157c478bd9Sstevel@tonic-gate 
2167c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || \
2177c478bd9Sstevel@tonic-gate 	(!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
2187c478bd9Sstevel@tonic-gate 	(_POSIX_C_SOURCE - 0 >= 199506L) || defined(_REENTRANT)
2197c478bd9Sstevel@tonic-gate extern struct tm *gmtime_r();
2207c478bd9Sstevel@tonic-gate extern struct tm *localtime_r();
2217c478bd9Sstevel@tonic-gate #endif
2227c478bd9Sstevel@tonic-gate 
2237c478bd9Sstevel@tonic-gate extern long timezone, altzone;
2247c478bd9Sstevel@tonic-gate extern int daylight;
2257c478bd9Sstevel@tonic-gate extern char *tzname[2];
2267c478bd9Sstevel@tonic-gate 
2277c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
2287c478bd9Sstevel@tonic-gate extern struct tm *getdate();
2297c478bd9Sstevel@tonic-gate #ifdef	_REENTRANT
2307c478bd9Sstevel@tonic-gate #undef getdate_err
2317c478bd9Sstevel@tonic-gate #define	getdate_err *(int *)_getdate_err_addr()
2327c478bd9Sstevel@tonic-gate extern int *_getdate_err_addr();
2337c478bd9Sstevel@tonic-gate #else
2347c478bd9Sstevel@tonic-gate extern int getdate_err;
2357c478bd9Sstevel@tonic-gate #endif /* _REENTRANT */
2367c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
2377c478bd9Sstevel@tonic-gate 
2387c478bd9Sstevel@tonic-gate #endif	/* __STDC__ */
2397c478bd9Sstevel@tonic-gate 
2407c478bd9Sstevel@tonic-gate /*
2417c478bd9Sstevel@tonic-gate  * ctime_r() & asctime_r() prototypes are defined here.
2427c478bd9Sstevel@tonic-gate  */
2437c478bd9Sstevel@tonic-gate 
2447c478bd9Sstevel@tonic-gate /*
2457c478bd9Sstevel@tonic-gate  * Previous releases of Solaris, starting at 2.3, provided definitions of
2467c478bd9Sstevel@tonic-gate  * various functions as specified in POSIX.1c, Draft 6.  For some of these
2477c478bd9Sstevel@tonic-gate  * functions, the final POSIX 1003.1c standard had a different number of
2487c478bd9Sstevel@tonic-gate  * arguments and return values.
2497c478bd9Sstevel@tonic-gate  *
2507c478bd9Sstevel@tonic-gate  * The following segment of this header provides support for the standard
2517c478bd9Sstevel@tonic-gate  * interfaces while supporting applications written under earlier
2527c478bd9Sstevel@tonic-gate  * releases.  The application defines appropriate values of the feature
2537c478bd9Sstevel@tonic-gate  * test macros _POSIX_C_SOURCE and _POSIX_PTHREAD_SEMANTICS to indicate
2547c478bd9Sstevel@tonic-gate  * whether it was written to expect the Draft 6 or standard versions of
2557c478bd9Sstevel@tonic-gate  * these interfaces, before including this header.  This header then
2567c478bd9Sstevel@tonic-gate  * provides a mapping from the source version of the interface to an
2577c478bd9Sstevel@tonic-gate  * appropriate binary interface.  Such mappings permit an application
2587c478bd9Sstevel@tonic-gate  * to be built from libraries and objects which have mixed expectations
2597c478bd9Sstevel@tonic-gate  * of the definitions of these functions.
2607c478bd9Sstevel@tonic-gate  *
2617c478bd9Sstevel@tonic-gate  * For applications using the Draft 6 definitions, the binary symbol is the
2627c478bd9Sstevel@tonic-gate  * same as the source symbol, and no explicit mapping is needed.  For the
2637c478bd9Sstevel@tonic-gate  * standard interface, the function func() is mapped to the binary symbol
2647c478bd9Sstevel@tonic-gate  * _posix_func().  The preferred mechanism for the remapping is a compiler
2657c478bd9Sstevel@tonic-gate  * #pragma.  If the compiler does not provide such a #pragma, the header file
2667c478bd9Sstevel@tonic-gate  * defines a static function func() which calls the _posix_func() version;
2677c478bd9Sstevel@tonic-gate  * this has to be done instead of #define since POSIX specifies that an
2687c478bd9Sstevel@tonic-gate  * application can #undef the symbol and still be bound to the correct
2697c478bd9Sstevel@tonic-gate  * implementation.  Unfortunately, the statics confuse lint so we fallback to
2707c478bd9Sstevel@tonic-gate  * #define in that case.
2717c478bd9Sstevel@tonic-gate  *
2727c478bd9Sstevel@tonic-gate  * NOTE: Support for the Draft 6 definitions is provided for compatibility
2737c478bd9Sstevel@tonic-gate  * only.  New applications/libraries should use the standard definitions.
2747c478bd9Sstevel@tonic-gate  */
2757c478bd9Sstevel@tonic-gate 
2767c478bd9Sstevel@tonic-gate #if	defined(__EXTENSIONS__) || defined(_REENTRANT) || \
2777c478bd9Sstevel@tonic-gate 	(!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
2787c478bd9Sstevel@tonic-gate 	(_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
2797c478bd9Sstevel@tonic-gate 
2807c478bd9Sstevel@tonic-gate #if	defined(__STDC__)
2817c478bd9Sstevel@tonic-gate 
2827c478bd9Sstevel@tonic-gate #if	(_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
2837c478bd9Sstevel@tonic-gate 
2847c478bd9Sstevel@tonic-gate #ifdef __PRAGMA_REDEFINE_EXTNAME
2857c478bd9Sstevel@tonic-gate #pragma redefine_extname ctime_r __posix_ctime_r
2867c478bd9Sstevel@tonic-gate #pragma redefine_extname asctime_r __posix_asctime_r
2877c478bd9Sstevel@tonic-gate extern char *asctime_r(const struct tm *_RESTRICT_KYWD, char *_RESTRICT_KYWD);
2887c478bd9Sstevel@tonic-gate extern char *ctime_r(const time_t *, char *);
2897c478bd9Sstevel@tonic-gate #else  /* __PRAGMA_REDEFINE_EXTNAME */
2907c478bd9Sstevel@tonic-gate 
2917c478bd9Sstevel@tonic-gate extern char *__posix_asctime_r(const struct tm *_RESTRICT_KYWD,
2927c478bd9Sstevel@tonic-gate     char *_RESTRICT_KYWD);
2937c478bd9Sstevel@tonic-gate extern char *__posix_ctime_r(const time_t *, char *);
2947c478bd9Sstevel@tonic-gate 
2957c478bd9Sstevel@tonic-gate #ifdef	__lint
2967c478bd9Sstevel@tonic-gate 
2977c478bd9Sstevel@tonic-gate #define	ctime_r __posix_ctime_r
2987c478bd9Sstevel@tonic-gate #define	asctime_r __posix_asctime_r
2997c478bd9Sstevel@tonic-gate 
3007c478bd9Sstevel@tonic-gate #else	/* !__lint */
3017c478bd9Sstevel@tonic-gate 
3027c478bd9Sstevel@tonic-gate static char *
3037c478bd9Sstevel@tonic-gate asctime_r(const struct tm *_RESTRICT_KYWD __tm, char *_RESTRICT_KYWD __buf)
3047c478bd9Sstevel@tonic-gate {
3057c478bd9Sstevel@tonic-gate 	return (__posix_asctime_r(__tm, __buf));
3067c478bd9Sstevel@tonic-gate }
3077c478bd9Sstevel@tonic-gate 
3087c478bd9Sstevel@tonic-gate static char *
3097c478bd9Sstevel@tonic-gate ctime_r(const time_t *__time, char *__buf)
3107c478bd9Sstevel@tonic-gate {
3117c478bd9Sstevel@tonic-gate 	return (__posix_ctime_r(__time, __buf));
3127c478bd9Sstevel@tonic-gate }
3137c478bd9Sstevel@tonic-gate 
3147c478bd9Sstevel@tonic-gate #endif /* !__lint */
3157c478bd9Sstevel@tonic-gate #endif /* __PRAGMA_REDEFINE_EXTNAME */
3167c478bd9Sstevel@tonic-gate 
3177c478bd9Sstevel@tonic-gate #else  /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
3187c478bd9Sstevel@tonic-gate 
3197c478bd9Sstevel@tonic-gate extern char *asctime_r(const struct tm *, char *, int);
3207c478bd9Sstevel@tonic-gate extern char *ctime_r(const time_t *, char *, int);
3217c478bd9Sstevel@tonic-gate 
3227c478bd9Sstevel@tonic-gate #endif  /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
3237c478bd9Sstevel@tonic-gate 
3247c478bd9Sstevel@tonic-gate #else  /* __STDC__ */
3257c478bd9Sstevel@tonic-gate 
3267c478bd9Sstevel@tonic-gate #if	(_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
3277c478bd9Sstevel@tonic-gate 
3287c478bd9Sstevel@tonic-gate #ifdef __PRAGMA_REDEFINE_EXTNAME
3297c478bd9Sstevel@tonic-gate #pragma redefine_extname asctime_r __posix_asctime_r
3307c478bd9Sstevel@tonic-gate #pragma redefine_extname ctime_r __posix_ctime_r
3317c478bd9Sstevel@tonic-gate extern char *asctime_r();
3327c478bd9Sstevel@tonic-gate extern char *ctime_r();
3337c478bd9Sstevel@tonic-gate #else  /* __PRAGMA_REDEFINE_EXTNAME */
3347c478bd9Sstevel@tonic-gate 
3357c478bd9Sstevel@tonic-gate extern char *__posix_asctime_r();
3367c478bd9Sstevel@tonic-gate extern char *__posix_ctime_r();
3377c478bd9Sstevel@tonic-gate 
3387c478bd9Sstevel@tonic-gate #ifdef	__lint
3397c478bd9Sstevel@tonic-gate 
3407c478bd9Sstevel@tonic-gate #define	asctime_r __posix_asctime_r
3417c478bd9Sstevel@tonic-gate #define	ctime_r __posix_ctime_r
3427c478bd9Sstevel@tonic-gate 
3437c478bd9Sstevel@tonic-gate #else	/* !__lint */
3447c478bd9Sstevel@tonic-gate 
3457c478bd9Sstevel@tonic-gate static char *
3467c478bd9Sstevel@tonic-gate asctime_r(__tm, __buf)
3477c478bd9Sstevel@tonic-gate 	struct tm *__tm;
3487c478bd9Sstevel@tonic-gate 	char *__buf;
3497c478bd9Sstevel@tonic-gate {
3507c478bd9Sstevel@tonic-gate 	return (__posix_asctime_r(__tm, __buf));
3517c478bd9Sstevel@tonic-gate }
3527c478bd9Sstevel@tonic-gate static char *
3537c478bd9Sstevel@tonic-gate ctime_r(__time, __buf)
3547c478bd9Sstevel@tonic-gate 	time_t *__time;
3557c478bd9Sstevel@tonic-gate 	char *__buf;
3567c478bd9Sstevel@tonic-gate {
3577c478bd9Sstevel@tonic-gate 	return (__posix_ctime_r(__time, __buf));
3587c478bd9Sstevel@tonic-gate }
3597c478bd9Sstevel@tonic-gate 
3607c478bd9Sstevel@tonic-gate #endif /* !__lint */
3617c478bd9Sstevel@tonic-gate #endif /* __PRAGMA_REDEFINE_EXTNAME */
3627c478bd9Sstevel@tonic-gate 
3637c478bd9Sstevel@tonic-gate #else  /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
3647c478bd9Sstevel@tonic-gate 
3657c478bd9Sstevel@tonic-gate extern char *asctime_r();
3667c478bd9Sstevel@tonic-gate extern char *ctime_r();
3677c478bd9Sstevel@tonic-gate 
3687c478bd9Sstevel@tonic-gate #endif /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
3697c478bd9Sstevel@tonic-gate 
3707c478bd9Sstevel@tonic-gate #endif /* __STDC__ */
3717c478bd9Sstevel@tonic-gate 
3727c478bd9Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__) || defined(_REENTRANT)... */
3737c478bd9Sstevel@tonic-gate 
3747c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
3757c478bd9Sstevel@tonic-gate }
3767c478bd9Sstevel@tonic-gate #endif
3777c478bd9Sstevel@tonic-gate 
3787c478bd9Sstevel@tonic-gate #endif	/* _TIME_H */
379