[Pkg-wmaker-commits] [wmifs] 84/118: wmifs: Replace deprecated usleep with nanosleep.
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Thu Aug 27 02:37:54 UTC 2015
This is an automated email from the git hooks/post-receive script.
dtorrance-guest pushed a commit to branch master
in repository wmifs.
commit 22ab1f28d0822d0a263a910f843d1d1ccac38847
Author: Doug Torrance <dtorrance at monmouthcollege.edu>
Date: Wed May 27 17:33:18 2015 -0500
wmifs: Replace deprecated usleep with nanosleep.
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.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/wmifs.c b/wmifs.c
index 22ce9bf..5a080da 100644
--- a/wmifs.c
+++ b/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);
}
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmifs.git
More information about the Pkg-wmaker-commits
mailing list