#ifndef _TIME_H
#define _TIME_H
#include <sys/feature_tests.h>
#include <iso/time_iso.h>
#if (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
(_POSIX_C_SOURCE > 2) || defined(__EXTENSIONS__) || defined(_STDC_C11)
#include <sys/types.h>
#include <sys/time_impl.h>
#endif
#if __cplusplus >= 199711L
using std::size_t;
using std::clock_t;
using std::time_t;
using std::tm;
using std::asctime;
using std::clock;
using std::ctime;
using std::difftime;
using std::gmtime;
using std::localtime;
using std::mktime;
using std::time;
using std::strftime;
#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(__EXTENSIONS__) || \
(!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
(_POSIX_C_SOURCE - 0 >= 199506L) || defined(_REENTRANT)
extern struct tm *gmtime_r(const time_t *_RESTRICT_KYWD,
struct tm *_RESTRICT_KYWD);
extern struct tm *localtime_r(const time_t *_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
#pragma redefine_extname strptime __strptime_dontzero
#else
extern char *__strptime_dontzero(const char *, const char *, struct tm *);
#define strptime __strptime_dontzero
#endif
#endif
extern char *strptime(const char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD,
struct tm *_RESTRICT_KYWD);
#endif
#if (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
(_POSIX_C_SOURCE > 2) || defined(__EXTENSIONS__)
#ifndef _SIGVAL
#define _SIGVAL
union sigval {
int sival_int;
void *sival_ptr;
};
#endif
#ifndef _SIGEVENT
#define _SIGEVENT
struct sigevent {
int sigev_notify;
int sigev_signo;
union sigval sigev_value;
void (*sigev_notify_function)(union sigval);
pthread_attr_t *sigev_notify_attributes;
int __sigev_pad2;
};
#endif
extern int clock_getres(clockid_t, struct timespec *);
extern int clock_gettime(clockid_t, struct timespec *);
extern int clock_settime(clockid_t, const struct timespec *);
extern int timer_create(clockid_t, struct sigevent *_RESTRICT_KYWD,
timer_t *_RESTRICT_KYWD);
extern int timer_delete(timer_t);
extern int timer_getoverrun(timer_t);
extern int timer_gettime(timer_t, struct itimerspec *);
extern int timer_settime(timer_t, int, const struct itimerspec *_RESTRICT_KYWD,
struct itimerspec *_RESTRICT_KYWD);
extern int nanosleep(const struct timespec *, struct timespec *);
extern int clock_nanosleep(clockid_t, int,
const struct timespec *, struct timespec *);
#endif
#if !defined(_STRICT_STDC) || defined(__XOPEN_OR_POSIX) || \
defined(__EXTENSIONS__)
extern void tzset(void);
extern char *tzname[2];
#if !defined(_XPG6) || defined(__EXTENSIONS__)
#ifndef CLK_TCK
extern long _sysconf(int);
#define CLK_TCK ((clock_t)_sysconf(3))
#endif
#endif
#if (!defined(_STRICT_STDC) && !defined(_POSIX_C_SOURCE)) || \
defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__)
extern long timezone;
extern int daylight;
#endif
#endif
#if (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
defined(__EXTENSIONS__)
extern time_t timegm(struct tm *);
extern int cftime(char *, char *, const time_t *);
extern int ascftime(char *, const char *, const struct tm *);
extern long altzone;
#endif
#if (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
defined(_XPG4_2) || defined(__EXTENSIONS__)
extern struct tm *getdate(const char *);
#ifdef _REENTRANT
#undef getdate_err
#define getdate_err *(int *)_getdate_err_addr()
extern int *_getdate_err_addr(void);
#else
extern int getdate_err;
#endif
#endif
#if defined(__EXTENSIONS__) || defined(_REENTRANT) || \
(!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
(_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
#if (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
#ifdef __PRAGMA_REDEFINE_EXTNAME
#pragma redefine_extname ctime_r __posix_ctime_r
#pragma redefine_extname asctime_r __posix_asctime_r
extern char *asctime_r(const struct tm *_RESTRICT_KYWD, char *_RESTRICT_KYWD);
extern char *ctime_r(const time_t *, char *);
#else
extern char *__posix_asctime_r(const struct tm *_RESTRICT_KYWD,
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
static char *
asctime_r(const struct tm *_RESTRICT_KYWD __tm, char *_RESTRICT_KYWD __buf)
{
return (__posix_asctime_r(__tm, __buf));
}
static char *
ctime_r(const time_t *__time, char *__buf)
{
return (__posix_ctime_r(__time, __buf));
}
#endif
#endif
#else
extern char *asctime_r(const struct tm *, char *, int);
extern char *ctime_r(const time_t *, char *, int);
#endif
#endif
#if defined(_XPG7) || !defined(_STRICT_SYMBOLS)
#ifndef _LOCALE_T
#define _LOCALE_T
typedef struct _locale *locale_t;
#endif
extern size_t strftime_l(char *_RESTRICT_KYWD, size_t,
const char *_RESTRICT_KYWD, const struct tm *_RESTRICT_KYWD, locale_t);
#endif
#if !defined(_STRICT_SYMBOLS) || defined(_STDC_C11)
#define TIME_UTC 0x1
#define TIME_MONOTONIC 0x2
#define TIME_ACTIVE 0x3
#define TIME_THREAD_ACTIVE 0x4
#define TIME_THREAD_ACTIVE_USR 0x5
extern int timespec_get(struct timespec *, int);
#endif
#if !defined(_STRICT_SYMBOLS) || defined(_STDC_C23)
extern int timespec_getres(struct timespec *, int);
#endif
#ifdef __cplusplus
}
#endif
#endif