Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
fe40523e
提交
fe40523e
authored
1月 22, 2013
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-4646 --resolve thanks for the update
上级
6b6198e9
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
16 行增加
和
11 行删除
+16
-11
switch_core_pvt.h
src/include/private/switch_core_pvt.h
+0
-2
switch_core.c
src/switch_core.c
+2
-3
switch_time.c
src/switch_time.c
+14
-6
没有找到文件。
src/include/private/switch_core_pvt.h
浏览文件 @
fe40523e
...
...
@@ -214,8 +214,6 @@ typedef enum {
struct
switch_runtime
{
switch_time_t
initiated
;
switch_time_t
mono_initiated
;
switch_time_t
mono_reference
;
switch_time_t
reference
;
int64_t
offset
;
switch_event_t
*
global_vars
;
...
...
src/switch_core.c
浏览文件 @
fe40523e
...
...
@@ -1664,8 +1664,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
switch_rtp_init
(
runtime
.
memory_pool
);
runtime
.
running
=
1
;
runtime
.
initiated
=
switch_time_now
();
runtime
.
mono_initiated
=
switch_mono_micro_time_now
();
runtime
.
initiated
=
switch_mono_micro_time_now
();
switch_scheduler_add_task
(
switch_epoch_time_now
(
NULL
),
heartbeat_callback
,
"heartbeat"
,
"core"
,
0
,
NULL
,
SSHF_NONE
|
SSHF_NO_DEL
);
...
...
@@ -2102,7 +2101,7 @@ SWITCH_DECLARE(void) switch_core_measure_time(switch_time_t total_ms, switch_cor
SWITCH_DECLARE
(
switch_time_t
)
switch_core_uptime
(
void
)
{
return
switch_mono_micro_time_now
()
-
runtime
.
mono_
initiated
;
return
switch_mono_micro_time_now
()
-
runtime
.
initiated
;
}
...
...
src/switch_time.c
浏览文件 @
fe40523e
...
...
@@ -180,6 +180,7 @@ static void do_sleep(switch_interval_time_t t)
clock_nanosleep
(
CLOCK_MONOTONIC
,
0
,
&
ts
,
NULL
);
#elif defined(DARWIN)
t
-=
OFFSET
;
ts
.
tv_sec
=
t
/
APR_USEC_PER_SEC
;
ts
.
tv_nsec
=
(
t
%
APR_USEC_PER_SEC
)
*
1000
;
nanosleep
(
&
ts
,
NULL
);
...
...
@@ -447,7 +448,7 @@ SWITCH_DECLARE(switch_time_t) switch_time_ref(void)
return
time_now
(
0
);
}
else
{
/* Return monotonic time reference (when available) */
return
time_now
(
-
1
);
return
switch_mono_micro_time_now
(
);
}
}
...
...
@@ -461,14 +462,12 @@ SWITCH_DECLARE(void) switch_time_sync(void)
if
(
SYSTEM_TIME
)
{
runtime
.
reference
=
time_now
(
0
);
runtime
.
mono_reference
=
time_now
(
-
1
);
runtime
.
offset
=
0
;
}
else
{
runtime
.
offset
=
runtime
.
reference
-
time_now
(
-
1
);
/* Get the offset between system time and the monotonic clock (when available) */
runtime
.
offset
=
runtime
.
reference
-
switch_mono_micro_time_now
(
);
/* Get the offset between system time and the monotonic clock (when available) */
runtime
.
reference
=
time_now
(
runtime
.
offset
);
}
if
(
runtime
.
reference
-
last_time
>
1000000
||
last_time
==
0
)
{
if
(
SYSTEM_TIME
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"Clock is already configured to always report system time.
\n
"
);
...
...
@@ -901,6 +900,8 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime)
while
(((
ts
=
time_now
(
runtime
.
offset
))
+
100
)
<
runtime
.
reference
)
{
if
(
ts
<
last
)
{
if
(
MONO
)
{
runtime
.
initiated
=
switch_mono_micro_time_now
()
-
((
last
-
runtime
.
offset
)
-
runtime
.
initiated
);
if
(
time_sync
==
runtime
.
time_sync
)
{
/* Only resync if not in the middle of switch_time_sync() already */
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CRIT
,
"Virtual Migration Detected! Syncing Clock
\n
"
);
win32_init_timers
();
/* Make sure to reinit timers on WIN32 */
...
...
@@ -918,8 +919,13 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime)
}
if
(
!
MONO
||
time_sync
==
runtime
.
time_sync
)
{
#if defined(HAVE_CLOCK_NANOSLEEP)
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CRIT
,
"If you see this message many times try setting the param enable-clock-nanosleep to true in switch.conf.xml or consider a nicer machine to run me on. I AM *FREE* afterall.
\n
"
);
#else
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CRIT
,
"If you see this message many times consider a nicer machine to run me on. I AM *FREE* afterall.
\n
"
);
#endif
}
}
else
{
rev_errs
=
0
;
...
...
@@ -955,6 +961,8 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime)
if
(
ts
>
(
runtime
.
reference
+
too_late
))
{
if
(
MONO
)
{
runtime
.
initiated
=
switch_mono_micro_time_now
()
-
(((
runtime
.
reference
-
runtime
.
microseconds_per_tick
)
-
runtime
.
offset
)
-
runtime
.
initiated
);
if
(
time_sync
==
runtime
.
time_sync
)
{
/* Only resync if not in the middle of switch_time_sync() already */
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CRIT
,
"Virtual Migration Detected! Syncing Clock
\n
"
);
win32_init_timers
();
/* Make sure to reinit timers on WIN32 */
...
...
@@ -962,7 +970,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime)
time_sync
=
runtime
.
time_sync
;
}
}
else
{
switch_time_t
diff
=
ts
-
runtime
.
reference
-
runtime
.
microseconds_per_tick
;
switch_time_t
diff
=
ts
-
(
runtime
.
reference
-
runtime
.
microseconds_per_tick
)
;
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CRIT
,
"Forward Clock Skew Detected!
\n
"
);
fwd_errs
++
;
runtime
.
reference
=
switch_time_now
();
...
...
@@ -1296,7 +1304,7 @@ SWITCH_MODULE_LOAD_FUNCTION(softtimer_load)
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_NOTICE
,
"Enabled Windows monotonic clock, using timeGetTime()
\n
"
);
}
runtime
.
mono_
initiated
=
switch_mono_micro_time_now
();
/* Update mono_initiated, since now is the first time the real clock is enabled */
runtime
.
initiated
=
switch_mono_micro_time_now
();
/* Update mono_initiated, since now is the first time the real clock is enabled */
}
/* No need to calibrate clock in Win32, we will only sleep ms anyway, it's just not accurate enough */
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论