[FIX]:fix timeout function
Change-Id: I8c36aa416d2ea190eaf1ec9d31cf8a77c21f4d0e
diff --git a/lib/liblynq-call/lynq_call.cpp b/lib/liblynq-call/lynq_call.cpp
index aa26125..45624b7 100755
--- a/lib/liblynq-call/lynq_call.cpp
+++ b/lib/liblynq-call/lynq_call.cpp
@@ -12,6 +12,8 @@
#include <cutils/jstring.h>
#include <pthread.h>
#include "liblog/lynq_deflog.h"
+#include <sys/time.h>
+
#define LYNQ_SERVICE_PORT 8088
#define LYNQ_URC_SERVICE_PORT 8086
#define LYNQ_REC_BUF 8192
@@ -265,15 +267,15 @@
int ret = 0;
int sec = 0;
int usec = 0;
- struct timespec start_tm;
- clock_gettime(CLOCK_MONOTONIC, &start_tm);
- struct timespec outTime;
+ struct timeval now;
+ struct timespec timeout;
+ gettimeofday(&now,NULL);
sec = mtime/1000;
usec = mtime%1000;
- outTime.tv_sec = start_tm.tv_sec + sec;
- outTime.tv_nsec = start_tm.tv_nsec + usec*1000000;
+ timeout.tv_sec = now.tv_sec+sec;
+ timeout.tv_nsec = now.tv_usec*1000+usec*1000000;
pthread_mutex_lock(&call_state_change_mutex);
- ret = pthread_cond_timedwait(&call_state_change_cond,&call_state_change_mutex,&outTime);
+ ret = pthread_cond_timedwait(&call_state_change_cond,&call_state_change_mutex,&timeout);
pthread_mutex_unlock(&call_state_change_mutex);
return ret;
}