00001 /* To be placed in include/osip2 directory */ 00002 00003 #ifndef _OSIP_TIME_H_ 00004 #define _OSIP_TIME_H_ 00005 00006 #ifdef __cplusplus 00007 extern "C" 00008 { 00009 #endif 00010 00011 /* Common time-related functions and data types */ 00012 00013 /* struct timeval, as defined in <sys/time.h>, <winsock.h> or <winsock2.h> */ 00014 struct timeval; 00015 00016 /* Time manipulation functions */ 00017 void add_gettimeofday(struct timeval *atv,int ms); 00018 void min_timercmp(struct timeval *tv1,struct timeval *tv2); 00019 00020 /* OS-dependent */ 00021 #if defined(WIN32) || defined(_WIN32_WCE) || defined (__VXWORKS_OS__) 00022 /* Operations on struct timeval */ 00023 #define osip_timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) 00024 # define osip_timercmp(a, b, CMP) \ 00025 (((a)->tv_sec == (b)->tv_sec) ? \ 00026 ((a)->tv_usec CMP (b)->tv_usec) : \ 00027 ((a)->tv_sec CMP (b)->tv_sec)) 00028 #define osip_timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0 00029 00030 /* osip_gettimeofday() for Windows */ 00031 int osip_gettimeofday(struct timeval *tp,void *tz); 00032 00033 #else 00034 /* Operations on struct timeval */ 00035 #define osip_timerisset(tvp) timerisset(tvp) 00036 #define osip_timercmp(tvp, uvp, cmp) timercmp(tvp,uvp,cmp) 00037 #define osip_timerclear(tvp) timerclear(tvp) 00038 00039 /* osip_gettimeofday() == gettimeofday() */ 00040 #define osip_gettimeofday gettimeofday 00041 00042 #endif /* #ifdef WIN32 */ 00043 00044 #ifdef __cplusplus 00045 } 00046 #endif 00047 00048 #endif /* #ifndef _OSIP_TIME_H_ */