From 1b34204261800897b46957bccd353470ef793a76 Mon Sep 17 00:00:00 2001 From: Martin Ling Date: Wed, 27 Nov 2013 11:11:55 +0000 Subject: [PATCH] Fix conversion of timeout to struct timeval. --- serialport.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/serialport.c b/serialport.c index af8f1b1..0a467de 100644 --- a/serialport.c +++ b/serialport.c @@ -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); }