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;
@ -50,7 +50,9 @@ typedef time_t cw_timer_t;
*/
#define cw_timer_timeout(t) (time(NULL)>t ? 1 : 0)
/**
* Get the number of nano seconds from a timeval.
*/
#define cw_timevaltodouble(tv) \
(( ((1000000.0)*(double)((tv)->tv_sec) + (double)(tv)->tv_usec)) )
@ -60,31 +62,32 @@ typedef time_t cw_timer_t;
* and #cw_clock_lap.
*
* @param c name of the variable
*/
*/
#define CLOCK_DEFINE(c)\
struct timeval c;
struct timeval c;
/**
* Start the clock (stop watch), start measuring time
* @param c a pounter to a variable defined with #DEFINE_CLOCK
*/
*/
#define cw_clock_start(c)\
gettimeofday(c,NULL);
/**
* 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.
*/
static inline double cw_clock_lap(struct timeval *tv){
*/
static inline double cw_clock_lap(struct timeval *tv)
{
struct timeval lap;
gettimeofday(&lap,NULL);
return (cw_timevaltodouble(&lap)-cw_timevaltodouble(tv))/1000000.0;
}
gettimeofday(&lap, NULL);
return (cw_timevaltodouble(&lap) - cw_timevaltodouble(tv)) / 1000000.0;
}
/**
* An alias for #cw_clock_lap
*/
*/
#define cw_clock_stop cw_clock_lap
/** @} */