From 3da7472ede2bfc475411e3fd4d3b40a1561bba0c Mon Sep 17 00:00:00 2001 From: "7u83@mail.ru" <7u83@mail.ru@noemail.net> Date: Sat, 11 Apr 2015 17:02:45 +0000 Subject: [PATCH] Inital. FossilOrigin-Name: f3e24ed8a02d7dd7df89110c8f4331392cda0af38f1c56a7088a34df1d0def8b --- src/capwap/timer.h | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/capwap/timer.h diff --git a/src/capwap/timer.h b/src/capwap/timer.h new file mode 100644 index 00000000..e29b8f82 --- /dev/null +++ b/src/capwap/timer.h @@ -0,0 +1,37 @@ +#ifndef __CW_TIMER_H +#define __CW_TIMER_H + +#include + +/** + * @defgroup TimerFunctions Timer functions + * @{ + */ + +/** + * Start a timer. + * @param t number of seconds until the timer expires + * @return timer value to initialize a variable of time_t + * + * Example: time_t timer = cw_timer_start(60); + */ +#define cw_timer_start(t) (time(NULL)+t) + +/** + * Check if a timer is expired. + * @param t an time_t variable intializes by #cw_timer_start + * @return 0=timer is not expired\n 1=timer is expired. + */ +#define cw_timer_timeout(t) (time(NULL)>t ? 1 : 0) + + +#define cw_clock_start()\ + clock() + +#define cw_clock_stop(t)\ + (((double) (clock()-(t))) / CLOCKS_PER_SEC) + +/** @} */ + + +#endif