2022-06-21 12:48:19 -05:00
|
|
|
#ifndef TIMER
|
|
|
|
#define TIMER
|
|
|
|
|
|
|
|
struct timer {
|
|
|
|
int timerid;
|
2022-08-22 08:55:54 -05:00
|
|
|
int on;
|
2022-06-21 12:48:19 -05:00
|
|
|
double fire_time;
|
2022-08-22 08:55:54 -05:00
|
|
|
double interval;
|
|
|
|
int repeat;
|
|
|
|
double remain_time;
|
|
|
|
void (*cb)(void *data);
|
|
|
|
void *data;
|
2022-06-21 12:48:19 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
void timer_init();
|
2022-08-22 08:55:54 -05:00
|
|
|
struct timer *timer_make(double interval, void (*callback)(void *param), void *param);
|
2022-06-21 12:48:19 -05:00
|
|
|
void timer_remove(struct timer *t);
|
2022-08-22 08:55:54 -05:00
|
|
|
void timer_start(struct timer *t);
|
|
|
|
void timer_pause(struct timer *t);
|
|
|
|
void timer_stop(struct timer *t);
|
|
|
|
void timer_update(double s);
|
|
|
|
void timer_settime(struct timer *t, double interval);
|
2022-06-21 12:48:19 -05:00
|
|
|
|
|
|
|
#endif
|