wrs_omxil: re-cal clock time for nsec overflow case
re-cal clock time if nsec overflows to make sure the right
time for pthread_cond_timewait
Bug: 25834559
Change-Id: I325fc3c032dd0d7b465c3aa44ff1b95700f89835
Signed-off-by: Nana Guo <nana.n.guo@intel.com>
diff --git a/base/src/portbase.cpp b/base/src/portbase.cpp
index de91e7c..a707876 100644
--- a/base/src/portbase.cpp
+++ b/base/src/portbase.cpp
@@ -595,6 +595,11 @@
clock_gettime(CLOCK_REALTIME, &tv);
tv.tv_sec += milliseconds/1000;
tv.tv_nsec+= (milliseconds%1000) * 1000000;
+ if (tv.tv_nsec >= 1000000000) {
+ tv.tv_sec += 1;
+ tv.tv_nsec -= 1000000000;
+ }
+
rc = pthread_cond_timedwait(&hdrs_wait, &hdrs_lock, &tv);
}
if (rc == ETIMEDOUT) {