Indentation + some comments.

FossilOrigin-Name: 49d9359ce17bafbbe7e511cb9cc9f3ed014e621df6df3c4c3d81f58d0a400fd7
This commit is contained in:
7u83@mail.ru 2015-05-01 18:44:18 +00:00
parent 4d8664a2eb
commit 2dbe69d18c
1 changed files with 15 additions and 12 deletions

View File

@ -29,7 +29,7 @@
*/ */
/** /**
* CAPWAP timer type, used in #cw_timer_start and #cw_timer_timeout. * CAPWAP timer type, used in conjunction with #cw_timer_start and #cw_timer_timeout.
*/ */
typedef time_t cw_timer_t; typedef time_t cw_timer_t;
@ -50,7 +50,9 @@ typedef time_t cw_timer_t;
*/ */
#define cw_timer_timeout(t) (time(NULL)>t ? 1 : 0) #define cw_timer_timeout(t) (time(NULL)>t ? 1 : 0)
/**
* Get the number of nano seconds from a timeval.
*/
#define cw_timevaltodouble(tv) \ #define cw_timevaltodouble(tv) \
(( ((1000000.0)*(double)((tv)->tv_sec) + (double)(tv)->tv_usec)) ) (( ((1000000.0)*(double)((tv)->tv_sec) + (double)(tv)->tv_usec)) )
@ -73,13 +75,14 @@ typedef time_t cw_timer_t;
/** /**
* Get lap time. (stop watch) * Get lap time. (stop watch)
* @param tv pointer to clock variable defined with #DEFINE_CLOCK * @param tv pointer to a clock variable defined with #CLOCK_DEFINE
* @return lap time in seconds. * @return lap time in seconds.
*/ */
static inline double cw_clock_lap(struct timeval *tv){ static inline double cw_clock_lap(struct timeval *tv)
{
struct timeval lap; struct timeval lap;
gettimeofday(&lap,NULL); gettimeofday(&lap, NULL);
return (cw_timevaltodouble(&lap)-cw_timevaltodouble(tv))/1000000.0; return (cw_timevaltodouble(&lap) - cw_timevaltodouble(tv)) / 1000000.0;
} }
/** /**