/* ****************************************************************************** * HEADER FILE * * Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: time.h,v $ $Revision: 1.2 $ * $Source: /home/interpeak/CVSRoot/ipxinc/include/sys/time.h,v $ * $Author: lob $ $Date: 2006-04-10 11:03:29 $ * $State: Exp $ $Locker: $ * * INTERPEAK_COPYRIGHT_STRING * Design and implementation by Lennart Bang ****************************************************************************** */ #ifndef IP_SYS_TIME_H #define IP_SYS_TIME_H /* **************************************************************************** * 1 DESCRIPTION **************************************************************************** */ /* **************************************************************************** * 2 CONFIGURATION **************************************************************************** */ #include "ipcom_config.h" /* **************************************************************************** * 3 INCLUDE FILES **************************************************************************** */ #include "sys/types.h" #define IPCOM_USE_CLIB_PROTO #include "ipcom_time.h" #ifdef __cplusplus extern "C" { #endif /* **************************************************************************** * 4 DEFINES **************************************************************************** */ #define ITIMER_REAL 0 #define ITIMER_VIRTUAL 1 #define ITIMER_PROF 2 # define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) # define timerclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0) # define timercmp(a, b, CMP) \ (((a)->tv_sec == (b)->tv_sec) ? \ ((a)->tv_usec CMP (b)->tv_usec) : \ ((a)->tv_sec CMP (b)->tv_sec)) # define timeradd(a, b, result) \ do { \ (result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \ (result)->tv_usec = (a)->tv_usec + (b)->tv_usec; \ if ((result)->tv_usec >= 1000000) { \ ++(result)->tv_sec; \ (result)->tv_usec -= 1000000; \ } \ } while (0) # define timersub(a, b, result) \ do { \ (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ if ((result)->tv_usec < 0) { \ --(result)->tv_sec; \ (result)->tv_usec += 1000000; \ } \ } while (0) /* **************************************************************************** * 5 TYPES **************************************************************************** */ #define timezone Ip_timezone struct Ip_itimerval { struct Ip_timeval it_interval; /* timer interval */ struct Ip_timeval it_value; /* current value */ }; #define itimerval Ip_itimerval /* **************************************************************************** * 6 FUNCTIONS **************************************************************************** */ int ipk_getitimer(int which, struct Ip_itimerval *value); #define getitimer ipk_getitimer int ipk_setitimer(int which, const struct Ip_itimerval *value, struct Ip_itimerval *ovalue); #define setitimer ipk_setitimer #ifdef NETSNMP_INTERPEAK #ifdef timezone #undef timezone #endif struct timezone { int tz_minuteswest; /* minutes W of Greenwich */ int tz_dsttime; /* type of dst correction */ }; extern int daylight; extern long timezone; #ifdef setitimer #undef setitimer #endif #define setitimer(w,v,o) ipnetsnmp_setitimer(w,v,o) IP_PUBLIC int ipnetsnmp_setitimer(int which, const struct Ip_itimerval *value, struct Ip_itimerval *ovalue); #endif /* #ifdef NETSNMP_INTERPEAK */ #ifdef __cplusplus } #endif #endif /* **************************************************************************** * END OF FILE **************************************************************************** */