mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-14 01:49:05 +00:00
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:
@@ -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)
|
||||
|
Reference in New Issue
Block a user