27 #define timercmp(a, b, CMP) \ 28 (((a)->tv_sec == (b)->tv_sec) ? \ 29 ((a)->tv_usec CMP (b)->tv_usec) : \ 30 ((a)->tv_sec CMP (b)->tv_sec)) 31 #define timeradd(a, b, result) \ 33 (result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \ 34 (result)->tv_usec = (a)->tv_usec + (b)->tv_usec; \ 35 if ((result)->tv_usec >= 1000000) \ 38 (result)->tv_usec -= 1000000; \ 41 #define timersub(a, b, result) \ 43 (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ 44 (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ 45 if ((result)->tv_usec < 0) { \ 47 (result)->tv_usec += 1000000; \ 51 #define USECS_PER_SEC 1000000 52 #define USECS_PER_TICK (USECS_PER_SEC / CFG_TICKS_PER_SECOND) 67 tick_t tick = tick_get();
72 tp->tv_sec = tick / CFG_TICKS_PER_SECOND;
74 ticks_left = tick % CFG_TICKS_PER_SECOND;
94 struct timeval current_time;
98 return_value.sec = current_time.tv_sec;
99 return_value.usec = current_time.tv_usec;
105 struct timeval start_time;
106 struct timeval timeout;
107 struct timeval stop_time;
112 timeradd (&start_time, &timeout, &stop_time);
114 self->stop_time.sec = stop_time.tv_sec;
115 self->stop_time.usec = stop_time.tv_usec;
120 struct timeval current_time;
121 struct timeval stop_time;
122 int is_not_yet_expired;
125 stop_time.tv_sec =
self->stop_time.sec;
126 stop_time.tv_usec =
self->stop_time.usec;
127 is_not_yet_expired =
timercmp (¤t_time, &stop_time, <);
129 return is_not_yet_expired ==
false;
boolean osal_timer_is_expired(osal_timert *self)
ec_timet osal_current_time(void)
#define timercmp(a, b, CMP)
#define timeradd(a, b, result)
int osal_usleep(uint32 usec)
int gettimeofday(struct timeval *tp, void *tzp)
int osal_gettimeofday(struct timeval *tv, struct timezone *tz)
void osal_timer_start(osal_timert *self, uint32 timeout_usec)