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