Mercurial > MadButterfly
diff src/mb_timer.h @ 39:db2aa914e14b
timer for animation
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Wed, 06 Aug 2008 21:05:11 +0800 |
parents | |
children | 400b4b5db0dc |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/mb_timer.h Wed Aug 06 21:05:11 2008 +0800 @@ -0,0 +1,27 @@ +#ifndef __MB_TIMER_H_ +#define __MB_TIMER_H_ + +typedef uint32_t mbsec_t; +typedef uint32_t mbusec_t; +typedef struct _mb_timer mb_timer_t; +typedef struct _mb_tman mb_tman_t; + +typedef void (*mb_tmo_hdlr)(mbsec_t sec, mbusec_t usec, + mbsec_t now_sec, mbusec_t now_usec, + void *arg); + +extern mb_tman_t *mb_tman_new(void); +extern void mb_tman_free(mb_tman_t *tman); +extern mb_timer_t *mb_tman_timeout(mb_tman_t *tman, + mbsec_t sec, mbusec_t usec, + mb_tmo_hdlr hdlr, void *arg); +extern int mb_tman_remove(mb_tman_t *tman, mb_timer_t *timer); +extern int mb_tman_next_timeout(mb_tman_t *tman, + mbsec_t now_sec, mbusec_t now_usec, + mbsec_t *after_sec, mbusec_t *after_usec); +extern int mb_tman_handle_timeout(mb_tman_t *tman, + mbsec_t now_sec, mbusec_t now_usec); + + + +#endif /* __MB_TIMER_H_ */