time.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _TIME_H
#define _TIME_H
#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.18 */
#include <sys/feature_tests.h>
#include <iso/time_iso.h>
#if (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
#include <sys/time_impl.h>
#endif /* (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) ... */
/*
* Allow global visibility for symbols defined in
* C++ "std" namespace in <iso/time_iso.h>.
*/
#if __cplusplus >= 199711L
#endif
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _CLOCKID_T
#define _CLOCKID_T
typedef int clockid_t;
#endif
#ifndef _TIMER_T
#define _TIMER_T
typedef int timer_t;
#endif
#if defined(__STDC__)
#if defined(__EXTENSIONS__) || \
(!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
struct tm *_RESTRICT_KYWD);
struct tm *_RESTRICT_KYWD);
#endif
#if (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
defined(_XPG4) || defined(__EXTENSIONS__)
#ifdef _STRPTIME_DONTZERO
#ifdef __PRAGMA_REDEFINE_EXTNAME
#else /* __PRAGMA_REDEFINE_EXTNAME */
extern char *__strptime_dontzero(const char *, const char *, struct tm *);
#define strptime __strptime_dontzero
#endif /* __PRAGMA_REDEFINE_EXTNAME */
#endif /* _STRPTIME_DONTZERO */
struct tm *_RESTRICT_KYWD);
#endif /* (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))... */
#if (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
/*
* definition of the sigevent structure. Both require the inclusion
* compiler warnings for applications that only include <time.h> and not
* also <signal.h>. The sigval union and the sigevent structure is
* via inclusion of <signal.h>.
*/
#ifndef _SIGVAL
#define _SIGVAL
union sigval {
int sival_int; /* integer value */
void *sival_ptr; /* pointer value */
};
#endif /* _SIGVAL */
#ifndef _SIGEVENT
#define _SIGEVENT
struct sigevent {
int sigev_notify; /* notification mode */
int sigev_signo; /* signal number */
void (*sigev_notify_function)(union sigval);
int __sigev_pad2;
};
#endif /* _SIGEVENT */
extern int timer_delete(timer_t);
extern int timer_getoverrun(timer_t);
struct itimerspec *_RESTRICT_KYWD);
extern int clock_nanosleep(clockid_t, int,
#endif /* (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))... */
#if !defined(_STRICT_STDC) || defined(__XOPEN_OR_POSIX) || \
defined(__EXTENSIONS__)
extern void tzset(void);
extern char *tzname[2];
/* CLK_TCK marked as LEGACY in SUSv2 and removed in SUSv3 */
#if !defined(_XPG6) || defined(__EXTENSIONS__)
#ifndef CLK_TCK
extern long _sysconf(int); /* System Private interface to sysconf() */
/* 3 is _SC_CLK_TCK */
#endif
#endif /* !defined(_XPG6) || defined(__EXTENSIONS__) */
#if (!defined(_STRICT_STDC) && !defined(_POSIX_C_SOURCE)) || \
defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__)
extern long timezone;
extern int daylight;
#endif
#endif /* !defined(_STRICT_STDC) || defined(__XOPEN_OR_POSIX)... */
#if (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))
extern long altzone;
#endif
#if (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
defined(_XPG4_2) || defined(__EXTENSIONS__)
#ifdef _REENTRANT
#define getdate_err *(int *)_getdate_err_addr()
extern int *_getdate_err_addr(void);
#else
extern int getdate_err;
#endif /* _REENTRANT */
#endif /* (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))... */
#else /* __STDC__ */
extern void tzset();
#ifdef _STRPTIME_DONTZERO
#ifdef __PRAGMA_REDEFINE_EXTNAME
#else /* __PRAGMA_REDEFINE_EXTNAME */
extern char *__strptime_dontzero();
#define strptime __strptime_dontzero
#endif /* __PRAGMA_REDEFINE_EXTNAME */
#endif /* _STRPTIME_DONTZERO */
extern char *strptime();
#if defined(__EXTENSIONS__) || \
(!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
extern struct tm *localtime_r();
#endif
extern int daylight;
extern char *tzname[2];
#ifdef _REENTRANT
#define getdate_err *(int *)_getdate_err_addr()
extern int *_getdate_err_addr();
#else
extern int getdate_err;
#endif /* _REENTRANT */
#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
#endif /* __STDC__ */
/*
* ctime_r() & asctime_r() prototypes are defined here.
*/
/*
* Previous releases of Solaris, starting at 2.3, provided definitions of
* various functions as specified in POSIX.1c, Draft 6. For some of these
* functions, the final POSIX 1003.1c standard had a different number of
* arguments and return values.
*
* The following segment of this header provides support for the standard
* interfaces while supporting applications written under earlier
* releases. The application defines appropriate values of the feature
* test macros _POSIX_C_SOURCE and _POSIX_PTHREAD_SEMANTICS to indicate
* whether it was written to expect the Draft 6 or standard versions of
* these interfaces, before including this header. This header then
* provides a mapping from the source version of the interface to an
* appropriate binary interface. Such mappings permit an application
* to be built from libraries and objects which have mixed expectations
* of the definitions of these functions.
*
* For applications using the Draft 6 definitions, the binary symbol is the
* same as the source symbol, and no explicit mapping is needed. For the
* standard interface, the function func() is mapped to the binary symbol
* _posix_func(). The preferred mechanism for the remapping is a compiler
* #pragma. If the compiler does not provide such a #pragma, the header file
* defines a static function func() which calls the _posix_func() version;
* this has to be done instead of #define since POSIX specifies that an
* application can #undef the symbol and still be bound to the correct
* implementation. Unfortunately, the statics confuse lint so we fallback to
* #define in that case.
*
* NOTE: Support for the Draft 6 definitions is provided for compatibility
* only. New applications/libraries should use the standard definitions.
*/
#if defined(__EXTENSIONS__) || defined(_REENTRANT) || \
(!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
#if defined(__STDC__)
#ifdef __PRAGMA_REDEFINE_EXTNAME
#else /* __PRAGMA_REDEFINE_EXTNAME */
char *_RESTRICT_KYWD);
extern char *__posix_ctime_r(const time_t *, char *);
#ifdef __lint
#define ctime_r __posix_ctime_r
#define asctime_r __posix_asctime_r
#else /* !__lint */
static char *
{
}
static char *
{
}
#endif /* !__lint */
#endif /* __PRAGMA_REDEFINE_EXTNAME */
#else /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
#endif /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
#else /* __STDC__ */
#ifdef __PRAGMA_REDEFINE_EXTNAME
extern char *asctime_r();
extern char *ctime_r();
#else /* __PRAGMA_REDEFINE_EXTNAME */
extern char *__posix_asctime_r();
extern char *__posix_ctime_r();
#ifdef __lint
#define asctime_r __posix_asctime_r
#define ctime_r __posix_ctime_r
#else /* !__lint */
static char *
char *__buf;
{
}
static char *
char *__buf;
{
}
#endif /* !__lint */
#endif /* __PRAGMA_REDEFINE_EXTNAME */
#else /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
extern char *asctime_r();
extern char *ctime_r();
#endif /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
#endif /* __STDC__ */
#endif /* defined(__EXTENSIONS__) || defined(_REENTRANT)... */
#ifdef __cplusplus
}
#endif
#endif /* _TIME_H */