Although defining _DEFAULT_SOURCE is overkill for nanosleep, it also fixes "field ‘b’ has incomplete type" errors, as we need __USE_MISC defined to pick up the definition of ifreq in <net/if.h>. --- wmifs/wmifs.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/wmifs/wmifs.c b/wmifs/wmifs.c index 22ce9bf..5a080da 100644 --- a/wmifs/wmifs.c +++ b/wmifs/wmifs.c @@ -176,6 +176,7 @@ * A bit of code clean-up. */ +#define _DEFAULT_SOURCE #include <stdlib.h> #include <stdio.h> #include <time.h> @@ -454,6 +455,8 @@ void wmifs_routine(int argc, char **argv) DrawActiveIFS(stat_devices[stat_current].name); while (1) { + struct timespec ts; + gettimeofday(&tv, NULL); curtime = (tv.tv_sec - tv2.tv_sec) * 1000 + (tv.tv_usec - tv2.tv_usec) / 1000; @@ -565,8 +568,9 @@ void wmifs_routine(int argc, char **argv) break; } } - - usleep(SampleInt * 1000); + ts.tv_sec = 0; + ts.tv_nsec = SampleInt * 1000000; + nanosleep(&ts, NULL); } } -- 2.1.4 -- To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.