From 181d5d6c396d8a453c7c128c8ad47158a3249d89 Mon Sep 17 00:00:00 2001 From: InHong Han Date: Fri, 2 Aug 2019 11:11:54 +0900 Subject: [PATCH] Fix signed integer overflow runtime error: signed integer overflow: 1560934086 * 1000000 cannot be represented in type 'long int' Change-Id: I20e4ffbdde24f1d714982c1fd90260f629caa29c --- ism/src/scim_helper.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ism/src/scim_helper.cpp b/ism/src/scim_helper.cpp index f3c6008..0f63b24 100644 --- a/ism/src/scim_helper.cpp +++ b/ism/src/scim_helper.cpp @@ -874,9 +874,9 @@ HelperAgent::wait_for_message(int cmd, int timeout) { struct timeval t0 = { 0, 0 }; struct timeval t1 = { 0, 0 }; + struct timeval t2 = { 0, 0 }; gettimeofday(&t0, NULL); - int etime = 0; do { if (!m_impl->socket.is_connected() || !m_impl->recv.read_from_socket(m_impl->socket, timeout)) @@ -888,8 +888,8 @@ HelperAgent::wait_for_message(int cmd, int timeout) } gettimeofday(&t1, NULL); - etime = ((t1.tv_sec * 1000000 + t1.tv_usec) - (t0.tv_sec * 1000000 + t0.tv_usec)) / 1000; - } while (etime < timeout); + timersub(&t1, &t0, &t2); + } while (t2.tv_sec < timeout); return false; } -- 2.7.4