From: Bernhard Tittelbach Date: Sat, 24 Apr 2010 02:29:06 +0000 (+0000) Subject: timespec X-Git-Url: https://git.realraum.at/?a=commitdiff_plain;h=2cb9372b30206febdd5dca6b106b811e3372f0f0;p=svn42.git timespec --- diff --git a/serial_console/sample_sensors.c b/serial_console/sample_sensors.c index 03b241d..01f4e88 100644 --- a/serial_console/sample_sensors.c +++ b/serial_console/sample_sensors.c @@ -48,7 +48,7 @@ void sample_sensors(int fd) { if (fd < 3) return; - struct timespec timeout; + struct timeval timeout; fd_set fds_r; unsigned int const buffer_size=1024; unsigned int buffer_offset=0; @@ -64,9 +64,9 @@ void sample_sensors(int fd) FD_ZERO(&fds_r); FD_SET(fd,&fds_r); timeout.tv_sec=1; - timeout.tv_nsec=0; + timeout.tv_usec=0; last_sample_time=time(0); - while (select(fd+1,&fds_r,0,0,0) > 0) + while (select(fd+1,&fds_r,0,0,timeout) > -1) { curr_time=time(0); if (FD_ISSET(fd,&fds_r)) @@ -122,7 +122,7 @@ void sample_sensors(int fd) FD_SET(fd,&fds_r); timeout.tv_sec=1; - timeout.tv_nsec=0; + timeout.tv_usec=0; } }