Use timeval helpers

Some of these changes actually fix broken comparisons which could
occasionally fail. Others just clean up the code and make it more clear.

Change-Id: I6c398bdc45fa0d2716f48a74822457d1351f81a5
Signed-off-by: Christopher Head <chead@zaber.com>
Reviewed-on: http://openocd.zylin.com/4380
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
This commit is contained in:
Christopher Head
2018-01-24 14:35:40 -08:00
committed by Freddie Chopin
parent e0fc7a54f2
commit 2428722a23
6 changed files with 15 additions and 34 deletions

View File

@@ -117,8 +117,7 @@ static int presto_read(uint8_t *buf, uint32_t size)
ftbytes += presto->retval;
gettimeofday(&now, NULL);
if ((now.tv_sec > timeout.tv_sec) ||
((now.tv_sec == timeout.tv_sec) && (now.tv_usec > timeout.tv_usec)))
if (timeval_compare(&now, &timeout) > 0)
break;
}