--- trunk/src/timer.c 2007/10/08 16:21:17 34 +++ trunk/src/timer.c 2007/10/08 16:22:32 42 @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * - * $Id: timer.c,v 1.6 2006/12/30 13:30:53 debug Exp $ + * $Id: timer.c,v 1.9 2007/06/15 17:02:38 debug Exp $ * * Timer framework. This is used by emulated clocks. */ @@ -37,6 +37,7 @@ #include #include +#include "misc.h" #include "timer.h" @@ -63,7 +64,7 @@ static int timer_is_running; -#define SECONDS_BETWEEN_GETTIMEOFDAY_SYNCH 1.5 +#define SECONDS_BETWEEN_GETTIMEOFDAY_SYNCH 1.65 /* @@ -76,11 +77,9 @@ struct timer *timer_add(double freq, void (*timer_tick)(struct timer *timer, void *extra), void *extra) { - struct timer *newtimer = malloc(sizeof(struct timer)); - if (newtimer == NULL) { - fprintf(stderr, "out of memory\n"); - exit(1); - } + struct timer *newtimer; + + CHECK_ALLOCATION(newtimer = malloc(sizeof(struct timer))); if (freq <= 0.00000001) freq = 0.00000001; @@ -168,7 +167,7 @@ tv.tv_sec --; } -#if 0 +#ifdef TIMER_DEBUG /* For debugging/testing: */ { double diff = tv.tv_usec * 0.000001 + tv.tv_sec @@ -285,7 +284,7 @@ timer_is_running = 0; timer_countdown_to_next_gettimeofday = 0; - timer_freq = 50.0; + timer_freq = TIMER_BASE_FREQUENCY; timer_current_time_step = 1.0 / timer_freq; #ifdef TEST