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:
Anthony Minessale
2008-01-11 00:43:49 +00:00
parent 886f99735a
commit 143bed09a3
38 changed files with 174 additions and 104 deletions

View File

@@ -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;