mirror of
git://sigrok.org/libserialport
synced 2023-08-10 21:13:24 +03:00
Fix conversion of timeout to struct timeval.
This commit is contained in:
parent
3353c22f32
commit
1b34204261
@ -870,7 +870,7 @@ enum sp_return sp_blocking_write(struct sp_port *port, const void *buf, size_t c
|
||||
gettimeofday(&start, NULL);
|
||||
/* Define duration of timeout. */
|
||||
delta.tv_sec = timeout / 1000;
|
||||
delta.tv_usec = timeout % 1000;
|
||||
delta.tv_usec = (timeout % 1000) * 1000;
|
||||
/* Calculate time at which we should give up. */
|
||||
timeradd(&start, &delta, &end);
|
||||
}
|
||||
@ -1041,7 +1041,7 @@ enum sp_return sp_blocking_read(struct sp_port *port, void *buf, size_t count, u
|
||||
gettimeofday(&start, NULL);
|
||||
/* Define duration of timeout. */
|
||||
delta.tv_sec = timeout / 1000;
|
||||
delta.tv_usec = timeout % 1000;
|
||||
delta.tv_usec = (timeout % 1000) * 1000;
|
||||
/* Calculate time at which we should give up. */
|
||||
timeradd(&start, &delta, &end);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user