]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
auto-sync idle timers
authorAnthony Minessale <anthony.minessale@gmail.com>
Mon, 27 Apr 2009 14:14:42 +0000 (14:14 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Mon, 27 Apr 2009 14:14:42 +0000 (14:14 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13161 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_time.c

index d20f9a293eaf38b6cbcd0a71b070f7c91f80018c..8897b1007b188a3d7c9ffa397c0acfdc18a9c3df 100644 (file)
@@ -324,7 +324,12 @@ static switch_status_t timer_next(switch_timer_t *timer)
 #else
        int cond_index = 1;
 #endif
+       int delta = (int)(private_info->reference - TIMER_MATRIX[timer->interval].tick);
 
+       /* sync up timer if it's not been called for a while otherwise it will return instantly several times until it catches up */
+       if (delta < 0) { 
+               private_info->reference = timer->tick = TIMER_MATRIX[timer->interval].tick;
+       }
        timer_step(timer);
 
        while (globals.RUNNING == 1 && private_info->ready && TIMER_MATRIX[timer->interval].tick < private_info->reference) {