/* * BEGIN_DESC * * File: * @(#)B11.23_LR common/sys/time.h $Revision: $ * * Purpose: * Definitions for time handling functions * * Classification: Release to Release Consistency Req: * public binary & source * * BE header: yes * * Shipped: yes * /usr/include/sys/time.h * /usr/conf/sys/time.h * * END_DESC */ #ifndef _SYS_TIME_INCLUDED #define _SYS_TIME_INCLUDED #include #include #include #ifdef __cplusplus # ifndef CLOCKS_PER_SEC # define CLOCKS_PER_SEC 1000000 # endif # ifndef NULL # if __cplusplus < 199707L # define NULL 0 /* old compiler requires 0 not 0L */ # else /* __cplusplus < 199707L */ # define NULL 0L /* new compiler allows preferred 0L */ # endif /* __cplusplus < 199707L */ # endif /* NULL */ #endif /* __cplusplus */ /* XOPEN defs */ #ifdef _XOPEN_SOURCE #if !defined(_XOPEN_SOURCE_EXTENDED) || (_XOPEN_SOURCE_EXTENDED +0 == -1) # ifndef _STRUCT_TM # define _STRUCT_TM _NAMESPACE_STD_START struct tm { int tm_sec; /* second (0-61, allows for leap seconds) */ int tm_min; /* minute (0-59) */ int tm_hour; /* hour (0-23) */ int tm_mday; /* day of the month (1-31) */ int tm_mon; /* month (0-11) */ int tm_year; /* years since 1900 */ int tm_wday; /* day of the week (0-6) */ int tm_yday; /* day of the year (0-365) */ int tm_isdst; /* non-0 if daylight savings time is in effect */ }; _NAMESPACE_STD_END # endif /* _STRUCT_TM */ # ifndef _GETDATE # define _GETDATE # ifndef _NO_USER_PROTOS # if defined(__ia64) && !defined(_LIBC) /* pragmas needed to support -B protected */ # pragma extern getdate # endif /* __ia64 && ! _LIBC */ # ifdef _PROTOTYPES extern __struct_tm *getdate(const char *); # else extern struct tm *getdate(); # endif /* _PROTOTYPES */ # endif /* ! _NO_USER_PROTOS */ # endif /* _GETDATE */ #endif /* !defined(_XOPEN_SOURCE_EXTENDED) || (_XOPEN_SOURCE_EXTENDED +0 == -1) */ #endif /* _XOPEN_SOURCE */ /* ANSI C time constants, types, and structures */ #ifdef _INCLUDE__STDC__ # if defined(_XPG4_EXTENDED) && !defined(_INCLUDE_HPUX_SOURCE) /* * For CASPEC, look in for the _XPG4_EXTENDED definition * only if _XPG4_EXTENDED is turned on EXPLICITLY. * But for all other cases, maintain definition(s) here * EXCEPT: time_t is defined in both and */ # else /* !_XPG4_EXTENDED || _INCLUDE_HPUX_SOURCE */ # ifndef CLOCKS_PER_SEC # define CLOCKS_PER_SEC 1000000 # endif #ifndef NULL # define NULL 0L #endif /* NULL */ /* Structure used with gmtime(), localtime(), mktime(), strftime(). */ #ifndef _STRUCT_TM # define _STRUCT_TM _NAMESPACE_STD_START struct tm { int tm_sec; /* second (0-61, allows for leap seconds) */ int tm_min; /* minute (0-59) */ int tm_hour; /* hour (0-23) */ int tm_mday; /* day of the month (1-31) */ int tm_mon; /* month (0-11) */ int tm_year; /* years since 1900 */ int tm_wday; /* day of the week (0-6) */ int tm_yday; /* day of the year (0-365) */ int tm_isdst; /* non-0 if daylight savings time is in effect */ }; _NAMESPACE_STD_END #endif /* _STRUCT_TM */ # endif /* _XPG4_EXTENDED && _INCLUDE_HPUX_SOURCE */ #endif /* _INCLUDE__STDC__ */ #ifdef _INCLUDE_POSIX4_SOURCE #ifndef _STRUCT_TIMESPEC #define _STRUCT_TIMESPEC /* Structure returned by clock_gettime(2) system call and others */ struct timespec { __time_t tv_sec; /* seconds */ long tv_nsec; /* and nanoseconds */ }; typedef struct timespec timestruc_t; #endif /* _STRUCT_TIMESPEC */ #ifndef _STRUCT_ITIMERSPEC #define _STRUCT_ITIMERSPEC /* Structure returned by timer_gettime(2) system call and others */ struct itimerspec { struct timespec it_interval; /* timer period */ struct timespec it_value; /* timer expiration */ }; #endif /* _STRUCT_ITIMERSPEC */ typedef enum __clockid_t { CLOCK_INVALID = 0, CLOCK_REALTIME = 1, /* the system-wide "wall clock" */ CLOCK_VIRTUAL = 2, /* the per-process user execution clock */ CLOCK_PROFILE = 4, /* the per-process execution clock */ RTTIMER0 = 8, RTTIMER1 = 16 } clockid_t; #ifndef _TIMER_T #define _TIMER_T typedef unsigned long timer_t; #if defined(_KERNEL) && defined(__LP64__) typedef unsigned int timer_32t; #endif /* defined(_KERNEL) && defined(__LP64__) */ #endif /* _TIMER_T_ */ #define TIMER_ABSTIME 0x1 #endif /* _INCLUDE_POSIX4_SOURCE */ /* Additional types needed for HP-UX */ #ifdef _INCLUDE_XOPEN_SOURCE_EXTENDED # ifndef _STRUCT_TIMEVAL # define _STRUCT_TIMEVAL /* Structure returned by gettimeofday(2) system call and others */ struct timeval { # if defined(_XPG4_EXTENDED) && !defined(_KERNEL) __time_t tv_sec; /* seconds */ # else /* !__XPG4_EXTENDED || _KERNEL*/ uint32_t tv_sec; /* seconds */ # endif /* __XPG4_EXTENDED && !_KERNEL*/ long tv_usec; /* and microseconds */ }; # endif /* !__STRUCT_TIMEVAL */ /* Structure defining a timer setting. */ struct itimerval { struct timeval it_interval; /* timer interval */ struct timeval it_value; /* current value */ }; # define _STRUCT_ITIMERVAL #endif /* _INCLUDE_XOPEN_SOURCE_EXTENDED */ #ifdef _INCLUDE_HPUX_SOURCE /* Structure used to represent timezones for gettimeofday(2) and others */ struct timezone { int tz_minuteswest; /* minutes west of Greenwich */ int tz_dsttime; /* type of dst correction */ }; # define _STRUCT_TIMEZONE /* Structure used to represent times as a 64-bit cycle count */ typedef struct __cycles { /* for counting machine cycles ... */ uint32_t hi; /* most significant bits */ uint32_t lo; /* least significant bits */ } cycles_t; #define _CYCLES_T #endif /* _INCLUDE_HPUX_SOURCE */ /* Function prototypes and external variable declarations */ #ifndef _NO_USER_PROTOS #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #if defined(_XPG4_EXTENDED) && !defined(_INCLUDE_HPUX_SOURCE) /* * For CASPEC, look in for the _XPG4_EXTENDED definition * But for all other cases, maintain definition(s) here */ #else /* !_XPG4_EXTENDED || _INCLUDE_HPUX_SOURCE */ # ifdef _INCLUDE__STDC__ # ifdef _PROTOTYPES _NAMESPACE_STD_START /* { */ # ifndef _DIFFTIME # define _DIFFTIME # if defined(__ia64) && !defined(_LIBC) /* pragmas needed to support -B protected */ # pragma extern difftime # endif /* __ia64 && ! _LIBC */ extern double difftime(time_t, time_t); # endif # ifndef _MKTIME # define _MKTIME # if defined(__ia64) && !defined(_LIBC) /* pragmas needed to support -B protected */ # pragma extern mktime # endif /* __ia64 && ! _LIBC */ extern time_t mktime(struct tm *); # endif # ifndef _TIME # define _TIME # if defined(__ia64) && !defined(_LIBC) /* pragmas needed to support -B protected */ # pragma extern time # endif /* __ia64 && ! _LIBC */ extern time_t time(time_t *); # endif # ifndef _ASCTIME # if defined(__ia64) && !defined(_LIBC) /* pragmas needed to support -B protected */ # pragma extern asctime # endif /* __ia64 && ! _LIBC */ extern char *asctime(const struct tm *); # endif # ifndef _CTIME # define _CTIME # if defined(__ia64) && !defined(_LIBC) /* pragmas needed to support -B protected */ # pragma extern ctime # endif /* __ia64 && ! _LIBC */ extern char *ctime(const time_t *); # endif # ifndef _GMTIME # define _GMTIME # if defined(__ia64) && !defined(_LIBC) /* pragmas needed to support -B protected */ # pragma extern gmtime # endif /* __ia64 && ! _LIBC */ extern struct tm *gmtime(const time_t *); # endif # ifndef _LOCALTIME # define _LOCALTIME # if defined(__ia64) && !defined(_LIBC) /* pragmas needed to support -B protected */ # pragma extern localtime # endif /* __ia64 && ! _LIBC */ extern struct tm *localtime(const time_t *); # endif # ifndef _STRFTIME # define _STRFTIME # if defined(__ia64) && !defined(_LIBC) /* pragmas needed to support -B protected */ # pragma extern strftime # endif /* __ia64 && ! _LIBC */ extern size_t strftime(char *, size_t, const char *, const struct tm *); # endif _NAMESPACE_STD_END /* } */ # ifdef _REENTRANT # ifndef _ASCTIME_R # define _ASCTIME_R # if defined(__ia64) && !defined(_LIBC) /* pragmas needed to support -B protected */ # pragma extern asctime_r # endif /* __ia64 && ! _LIBC */ # ifndef _PTHREADS_DRAFT4 extern char *asctime_r(const __struct_tm *, char *); # else /* _PTHREADS_DRAFT4 */ extern int asctime_r(const __struct_tm *, char *, int); # endif /* _PTHREADS_DRAFT4 */ # endif # ifndef _CTIME_R # define _CTIME_R # if defined(__ia64) && !defined(_LIBC) /* pragmas needed to support -B protected */ # pragma extern ctime_r # endif /* __ia64 && ! _LIBC */ # ifndef _PTHREADS_DRAFT4 extern char *ctime_r(const __time_t *, char *); # else /* _PTHREADS_DRAFT4 */ extern int ctime_r(const __time_t *, char *, int); # endif /* _PTHREADS_DRAFT4 */ # endif #ifndef _GMTIME_R # define _GMTIME_R # if defined(__ia64) && !defined(_LIBC) /* pragmas needed to support -B protected */ # pragma extern gmtime_r # endif /* __ia64 && ! _LIBC */ # ifndef _PTHREADS_DRAFT4 extern __struct_tm *gmtime_r(const __time_t *, __struct_tm *); # else /* _PTHREADS_DRAFT4 */ extern int gmtime_r(const __time_t *, __struct_tm *); # endif /* _PTHREADS_DRAFT4 */ # endif # ifndef _LOCALTIME_R # define _LOCALTIME_R # if defined(__ia64) && !defined(_LIBC) /* pragmas needed to support -B protected */ # pragma extern localtime_r # endif /* __ia64 && ! _LIBC */ # ifndef _PTHREADS_DRAFT4 extern __struct_tm *localtime_r(const __time_t *, __struct_tm *); # else /* _PTHREADS_DRAFT4 */ extern int localtime_r(const __time_t *, __struct_tm *); # endif /* _PTHREADS_DRAFT4 */ # endif # endif # else /* not _PROTOTYPES */ # ifndef _DIFFTIME # define _DIFFTIME # if defined(__ia64) && !defined(_LIBC) /* pragmas needed to support -B protected */ # pragma extern difftime # endif /* __ia64 && ! _LIBC */ extern double difftime(); # endif # ifndef _MKTIME # define _MKTIME # if defined(__ia64) && !defined(_LIBC) /* pragmas needed to support -B protected */ # pragma extern mktime # endif /* __ia64 && ! _LIBC */ extern time_t mktime(); # endif # ifndef _TIME # define _TIME # if defined(__ia64) && !defined(_LIBC) /* pragmas needed to support -B protected */ # pragma extern time # endif /* __ia64 && ! _LIBC */ extern time_t time(); # endif # ifndef _ASCTIME # define _ASCTIME # if defined(__ia64) && !defined(_LIBC) /* pragmas needed to support -B protected */ # pragma extern asctime # endif /* __ia64 && ! _LIBC */ extern char *asctime(); # endif # ifndef _CTIME # define _CTIME # if defined(__ia64) && !defined(_LIBC) /* pragmas needed to support -B protected */ # pragma extern ctime # endif /* __ia64 && ! _LIBC */ extern char *ctime(); # endif # ifndef _GMTIME # define _GMTIME # if defined(__ia64) && !defined(_LIBC) /* pragmas needed to support -B protected */ # pragma extern gmtime # endif /* __ia64 && ! _LIBC */ extern struct tm *gmtime(); # endif # ifndef _LOCALTIME # define _LOCALTIME # if defined(__ia64) && !defined(_LIBC) /* pragmas needed to support -B protected */ # pragma extern localtime # endif /* __ia64 && ! _LIBC */ extern struct tm *localtime(); # endif # ifndef _STRFTIME # define _STRFTIME # if defined(__ia64) && !defined(_LIBC) /* pragmas needed to support -B protected */ # pragma extern strftime # endif /* __ia64 && ! _LIBC */ extern size_t strftime(); # endif # ifdef _REENTRANT # ifndef _ASCTIME_R # define _ASCTIME_R # if defined(__ia64) && !defined(_LIBC) /* pragmas needed to support -B protected */ # pragma extern asctime_r # endif /* __ia64 && ! _LIBC */ # ifndef _PTHREADS_DRAFT4 extern char * asctime_r(); # else /*_PTHREADS_DRAFT4 */ extern int asctime_r(); # endif /*_PTHREADS_DRAFT4 */ # endif # ifndef _CTIME_R # define _CTIME_R # if defined(__ia64) && !defined(_LIBC) /* pragmas needed to support -B protected */ # pragma extern ctime_r # endif /* __ia64 && ! _LIBC */ # ifndef _PTHREADS_DRAFT4 extern char *ctime_r(); # else /*_PTHREADS_DRAFT4 */ extern int ctime_r(); # endif /*_PTHREADS_DRAFT4 */ # endif # ifndef _GMTIME_R # define _GMTIME_R # if defined(__ia64) && !defined(_LIBC) /* pragmas needed to support -B protected */ # pragma extern gmtime_r # endif /* __ia64 && ! _LIBC */ # ifndef _PTHREADS_DRAFT4 extern struct tm *gmtime_r(); # else /*_PTHREADS_DRAFT4 */ extern int gmtime_r(); # endif /*_PTHREADS_DRAFT4 */ # endif #ifndef _LOCALTIME_R # define _LOCALTIME_R # if defined(__ia64) && !defined(_LIBC) /* pragmas needed to support -B protected */ # pragma extern localtime_r # endif /* __ia64 && ! _LIBC */ # ifndef _PTHREADS_DRAFT4 extern struct tm *localtime_r(); # else /*_PTHREADS_DRAFT4 */ extern int localtime_r(); # endif /*_PTHREADS_DRAFT4 */ # endif # endif # endif /* not _PROTOTYPES */ # if defined(__ia64) && !defined(_LIBC) /* pragmas needed to support -B protected */ # ifndef _CLOCK # pragma extern clock # endif /* _CLOCK */ # endif /* __ia64 && ! _LIBC */ # ifdef _CLASSIC_ANSI_TYPES # ifndef _CLOCK # define _CLOCK extern long clock(); /* REVISIT FOR 64BIT CLEAN */ # endif # else /* not _CLASSIC_ANSI_TYPES */ # ifdef _PROTOTYPES # ifndef _CLOCK # define _CLOCK _NAMESPACE_STD_START extern clock_t clock(void); _NAMESPACE_STD_END # endif # else /* not _PROTOTYPES */ # ifndef _CLOCK # define _CLOCK extern clock_t clock(); # endif # endif /* not _PROTOTYPES */ # endif /* not _CLASSIC_ANSI_TYPES */ #endif /* _INCLUDE__STDC__ */ #ifdef _INCLUDE_POSIX_SOURCE # if defined(__ia64) && !defined(_LIBC) /* pragmas needed to support -B protected */ # ifndef _TZSET # pragma extern tzset # endif /* _TZSET */ # endif /* __ia64 && ! _LIBC */ # ifdef _PROTOTYPES # ifndef _TZSET # define _TZSET extern void tzset(void); # endif # else /* not _PROTOTYPES */ # ifndef _TZSET # define _TZSET extern void tzset(); # endif # endif /* not _PROTOTYPES */ # if defined(__ia64) && !defined(_LIBC) /* pragmas needed to support -B protected */ # pragma extern tzname # endif /* __ia64 && ! _LIBC */ extern char *tzname[2]; # endif /* _INCLUDE_POSIX_SOURCE */ #endif /* _XPG4_EXTENDED || !_INCLUDE_HPUX_SOURCE */ #ifdef _INCLUDE_POSIX4_SOURCE # if defined(__ia64) && !defined(_LIBC) /* pragmas needed to support -B protected */ # pragma extern clock_settime, clock_gettime, clock_getres # pragma extern timer_create, timer_delete, timer_settime # pragma extern timer_gettime, timer_getoverrun, nanosleep # endif /* __ia64 && ! _LIBC */ # ifdef _PROTOTYPES extern int clock_settime(clockid_t, const struct timespec *); extern int clock_gettime(clockid_t, struct timespec *); extern int clock_getres(clockid_t, struct timespec *); extern int timer_create(clockid_t, struct sigevent *, timer_t *); extern int timer_delete(timer_t); extern int timer_settime(timer_t, int, const struct itimerspec *, struct itimerspec *); extern int timer_gettime(timer_t, struct itimerspec *); extern int timer_getoverrun(timer_t); extern int nanosleep(const struct timespec *, struct timespec *); # else /* not _PROTOTYPES */ extern int clock_settime(); extern int clock_gettime(); extern int clock_getres(); extern int timer_create(); extern int timer_delete(); extern int timer_settime(); extern int timer_gettime(); extern int timer_getoverrun(); extern int nanosleep(); # endif /* not _PROTOTYPES */ #endif /* _INCLUDE_POSIX4_SOURCE */ #if defined(_XPG4_EXTENDED) && !defined(_INCLUDE_HPUX_SOURCE) /* * For CASPEC, look in for the _XPG4_EXTENDED definition * But for all other cases, maintain definition(s) here */ #else /* !_XPG4_EXTENDED || _INCLUDE_HPUX_SOURCE */ # ifdef _INCLUDE_XOPEN_SOURCE # if defined(__ia64) && !defined(_LIBC) /* pragmas needed to support -B protected */ # ifndef _STRPTIME # pragma extern strptime # endif /* _STRPTIME */ # ifndef _TIMEZONE # pragma extern timezone # endif /* _TIMEZONE */ # ifndef _DAYLIGHT # pragma extern daylight # endif /* _DAYLIGHT */ # endif /* __ia64 && ! _LIBC */ # ifdef _PROTOTYPES # ifndef _STRPTIME # define _STRPTIME extern char *strptime(const char *, const char *, __struct_tm *); # endif # else /* not _PROTOTYPES */ # ifndef _STRPTIME # define _STRPTIME extern char *strptime(); # endif # endif /* not _PROTOTYPES */ # ifndef _TIMEZONE # define _TIMEZONE extern long timezone; # endif # ifndef _DAYLIGHT # define _DAYLIGHT extern int daylight; # endif # endif /* _INCLUDE_XOPEN_SOURCE */ #endif /* _XPG4_EXTENDED && !_INCLUDE_HPUX_SOURCE */ #ifdef __cplusplus } #endif /* __cplusplus */ #ifdef _INCLUDE_XOPEN_SOURCE_EXTENDED /* For FD_* macros and struct fd_set. Here we get the x/Open version. */ # ifndef _MAXFUPLIM # include # endif /* not _MAXFUPLIM */ # ifdef __cplusplus extern "C" { # endif /* __cplusplus */ # if defined(__ia64) && !defined(_LIBC) /* pragmas needed to support -B protected */ # pragma extern getitimer, setitimer, utimes, gettimeofday, select # endif /* __ia64 && ! _LIBC */ # ifdef _PROTOTYPES extern int getitimer(int, struct itimerval *); extern int setitimer(int, const struct itimerval *, struct itimerval *); extern int utimes(const char *, const struct timeval[2]); extern int gettimeofday(struct timeval *, void *); # if defined(__INCLUDE_FROM_TIME_H) && !defined(_XOPEN_SOURCE_EXTENDED) extern int select(__size_t, int *, int *, int *, const struct timeval *); # else /* __INCLUDE_FROM_TIME_H && !_XOPEN_SOURCE_EXTENDED */ extern int select(int, fd_set *, fd_set *, fd_set *, struct timeval *); # endif /* __INCLUDE_FROM_TIME_H && !_XOPEN_SOURCE_EXTENDED */ # else /* !_PROTOTYPES */ extern int getitimer(); extern int setitimer(); extern int utimes(); extern int select(); extern int gettimeofday(); # endif /* _PROTOTYPES */ # ifdef __cplusplus } # endif /* __cplusplus */ #endif /* _INCLUDE_XOPEN_SOURCE_EXTENDED */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #ifdef _INCLUDE_HPUX_SOURCE # if defined(__ia64) && !defined(_LIBC) /* pragmas needed to support -B protected */ # pragma extern adjtime # ifndef _GETDATE # pragma extern getdate # endif /* _GETDATE */ # ifndef _GETDATE_R # ifdef _PTHREADS_DRAFT4 # pragma extern getdate_r # endif /* _PTHREADS_DRAFT4 */ # endif /* _GETDATE_R */ # pragma extern settimeofday, stime, profil # endif /* __ia64 && ! _LIBC */ # ifdef _PROTOTYPES extern int adjtime(const struct timeval *, struct timeval *); # ifndef _GETDATE # define _GETDATE extern __struct_tm *getdate(const char *); # endif # ifndef _GETDATE_R # define _GETDATE_R # ifdef _PTHREADS_DRAFT4 extern int getdate_r(const char *, __struct_tm *, int *); # endif /* _PTHREADS_DRAFT4 */ # endif extern int settimeofday(const struct timeval *, const struct timezone *); extern int stime(const __time_t *); extern void profil(void *, __size_t, __size_t, int); # else /* not _PROTOTYPES */ extern int adjtime(); # ifndef _GETDATE # define _GETDATE extern struct tm *getdate(); # endif # ifndef _GETDATE_R # define _GETDATE_R # ifdef _PTHREADS_DRAFT4 extern int getdate_r(); # endif /* _PTHREADS_DRAFT4 */ # endif extern int settimeofday(); extern int stime(); extern void profil(); # endif /* not _PROTOTYPES */ # ifndef _GETDATE_ERR # define _GETDATE_ERR #if defined(_REENTRANT) && !defined(_PTHREADS_DRAFT4) # if defined(__ia64) && !defined(_LIBC) /* pragmas needed to support -B protected */ # pragma extern __getdate_error # endif /* __ia64 && ! _LIBC */ int * __getdate_error __((void)) ; # define getdate_err (*__getdate_error()) # else # if defined(__ia64) && !defined(_LIBC) /* pragmas needed to support -B protected */ # pragma extern getdate_err # endif /* __ia64 && ! _LIBC */ extern int getdate_err; # endif /* defined(_REENTRANT) && !defined(_PTHREADS_DRAFT4) */ # endif #endif /* _INCLUDE_HPUX_SOURCE */ #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* not _NO_USER_PROTOS */ #if defined(_XPG4_EXTENDED) && !defined(_INCLUDE_HPUX_SOURCE) /* * For CASPEC, look in for the _XPG4_EXTENDED definition * But for all other cases, maintain definition(s) here */ #else /* not _XPG4_EXTENDED */ /* * CLK_TCK is needed by the kernel, and also in the POSIX namespace. */ # ifdef _INCLUDE_POSIX_SOURCE # ifndef CLK_TCK # define CLK_TCK 100 # endif /* CLK_TCK */ # endif #endif /* _XPG4_EXTENDED */ #ifdef _INCLUDE_XOPEN_SOURCE_EXTENDED /* Additional structures, macros, and constants */ /* Names of the interval timers */ # define ITIMER_REAL 0 # define ITIMER_VIRTUAL 1 # define ITIMER_PROF 2 /* * Thread specific timers. */ # define ITIMER_THREAD_REAL 3 # define ITIMER_THREAD_VIRTUAL 4 # define ITIMER_THREAD_PROF 5 #endif /* _INCLUDE_XOPEN_SOURCE_EXTENDED */ /* Additional HP-UX structures, macros, and constants */ #ifdef _INCLUDE_HPUX_SOURCE /* Kernel instrumentation time value */ struct ki_timeval { uint32_t pad1; uint32_t pad2; }; /* * The definition of kt_t assumes 2 things : * First, 32bit data types are alligned 32bit (i.e. and int is * not padded to 8 bytes). * Second, any consumer that truely uses KI (and thus kt_t) will * be compiled in extended mode. * * If the size of kt_t changes or compiler alignment rules change, this * will have to be adjusted. */ /* 11.0 and later representation of ki time*/ #if !defined(_KT_T) #define _KT_T #if !defined(__STDC_32_MODE__) typedef uint64_t kt_t; #else typedef struct ki_timeval kt_t; #endif /*narrow mode space reservation*/ #endif /* _KT_T */ /* Kinds of daylight savings time */ # define DST_NONE 0 /* not on dst */ # define DST_USA 1 /* USA style dst */ # define DST_AUST 2 /* Australian style dst */ # define DST_WET 3 /* Western European dst */ # define DST_MET 4 /* Middle European dst */ # define DST_EET 5 /* Eastern European dst */ /* * Operations on timevals. * * NB: timercmp does not work for >= or <= or ==. */ # define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) # define timercmp(tvp, uvp, cmp) \ ((tvp)->tv_sec cmp (uvp)->tv_sec || \ (tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec) # define timerclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0L) # define is_valid_timeval(tvp) \ ((tvp)->tv_usec >= 0L && (tvp)->tv_usec < 1000000L) /* * Operations on timespecs. * * NB: timespeccmp works for < and >, not >=, == or <=. */ #define timespeccmp(tsp1, tsp2, op) \ ((tsp1)->tv_sec op (tsp2)->tv_sec || \ ((tsp1)->tv_sec == (tsp2)->tv_sec && (tsp1)->tv_nsec op (tsp2)->tv_nsec)) #define timespeceq(tsp1, tsp2) \ ((tsp1)->tv_sec == (tsp2)->tv_sec && \ (tsp1)->tv_nsec == (tsp2)->tv_nsec) #define timespecclear(tsp) ((tsp)->tv_sec = (tsp)->tv_nsec = 0L) #define timespecisset(tsp) ((tsp)->tv_nsec || (tsp)->tv_sec) #endif /* _INCLUDE_HPUX_SOURCE */ #endif /* _SYS_TIME_INCLUDED */