mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-14 01:49:05 +00:00
try to use clock_gettime to make sure we don't care if the system time changes
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7165 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -2077,14 +2077,14 @@ static JSBool session_wait_for_media(JSContext * cx, JSObject * obj, uintN argc,
|
||||
channel = switch_core_session_get_channel(jss->session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
started = switch_time_now();
|
||||
started = switch_timestamp_now();
|
||||
|
||||
if (argc > 0) {
|
||||
JS_ValueToInt32(cx, argv[0], &timeout);
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
if (((elapsed = (unsigned int) ((switch_time_now() - started) / 1000)) > (switch_time_t) timeout)
|
||||
if (((elapsed = (unsigned int) ((switch_timestamp_now() - started) / 1000)) > (switch_time_t) timeout)
|
||||
|| switch_channel_get_state(channel) >= CS_HANGUP) {
|
||||
*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
|
||||
break;
|
||||
@@ -2116,14 +2116,14 @@ static JSBool session_wait_for_answer(JSContext * cx, JSObject * obj, uintN argc
|
||||
channel = switch_core_session_get_channel(jss->session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
started = switch_time_now();
|
||||
started = switch_timestamp_now();
|
||||
|
||||
if (argc > 0) {
|
||||
JS_ValueToInt32(cx, argv[0], &timeout);
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
if (((elapsed = (unsigned int) ((switch_time_now() - started) / 1000)) > (switch_time_t) timeout)
|
||||
if (((elapsed = (unsigned int) ((switch_timestamp_now() - started) / 1000)) > (switch_time_t) timeout)
|
||||
|| switch_channel_get_state(channel) >= CS_HANGUP) {
|
||||
*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
|
||||
break;
|
||||
|
Reference in New Issue
Block a user