add fsctl sync_clock_when_idle so you can sync the clock but have it not do it till there are 0 calls

This commit is contained in:
Anthony Minessale
2011-10-12 14:55:32 -05:00
parent 1bf97fa7ba
commit 2094f2d33b
6 changed files with 51 additions and 3 deletions

View File

@@ -411,11 +411,18 @@ SWITCH_DECLARE(switch_time_t) switch_time_ref(void)
return time_now(0);
}
static switch_time_t last_time = 0;
SWITCH_DECLARE(void) switch_time_sync(void)
{
runtime.reference = switch_time_now();
runtime.offset = runtime.reference - time_now(0);
runtime.reference = time_now(runtime.offset);
if (runtime.reference - last_time > 1000000 || last_time == 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Clock syncronized to system time.\n");
}
last_time = runtime.reference;
}
SWITCH_DECLARE(void) switch_micro_sleep(switch_interval_time_t t)