diff options
author | Christopher Head <chead@zaber.com> | 2018-01-24 14:35:40 -0800 |
---|---|---|
committer | Freddie Chopin <freddie.chopin@gmail.com> | 2018-01-25 16:43:49 +0000 |
commit | 2428722a23d8a08b15331ab95884762e5f329a02 (patch) | |
tree | 1cb2324b2c7b02945369b53c5704ad936969e824 /src/jtag/drivers/presto.c | |
parent | e0fc7a54f287aad414b373410e09faa048f3a9dd (diff) |
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>
Diffstat (limited to 'src/jtag/drivers/presto.c')
-rw-r--r-- | src/jtag/drivers/presto.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/jtag/drivers/presto.c b/src/jtag/drivers/presto.c index 49caa679..29bc8111 100644 --- a/src/jtag/drivers/presto.c +++ b/src/jtag/drivers/presto.c @@ -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; } |