]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FSCORE-639
authorAnthony Minessale <anthm@freeswitch.org>
Fri, 30 Jul 2010 07:20:54 +0000 (02:20 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Fri, 30 Jul 2010 07:20:54 +0000 (02:20 -0500)
src/mod/applications/mod_commands/mod_commands.c
src/switch_time.c

index a23ef4efa3d71a2d4d0b82e70ef9511d621e29bf..f27c2ec0eb466d5146331b2213d572d30fee766e 100644 (file)
@@ -312,6 +312,13 @@ SWITCH_STANDARD_API(timer_test_function)
                goto end;
        }
 
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Timer Test: samplecount after init: %d\n", timer.samplecount);
+
+       /* Step timer once before testing results below, to get first timestamp as accurate as possible */
+       switch_core_timer_next(&timer);
+
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Timer Test: samplecount after first step: %d\n", timer.samplecount);
+
        start = switch_time_ref();
        for (x = 1; x <= max; x++) {
                then = switch_time_ref();
index 7ffdf4e4d7d7010ae87ad2983bc7b60aa2c34a27..8465e5dcc0d098775d712ffaab43b0d59648de61 100644 (file)
@@ -485,6 +485,7 @@ static switch_status_t timer_init(switch_timer_t *timer)
                switch_mutex_unlock(globals.mutex);
                timer->private_info = private_info;
                private_info->start = private_info->reference = TIMER_MATRIX[timer->interval].tick;
+               private_info->start -= 2; /* switch_core_timer_init sets samplecount to samples, this makes first next() step once */
                private_info->roll = TIMER_MATRIX[timer->interval].roll;
                private_info->ready = 1;