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>.
This commit is contained in:
parent
90565e05d5
commit
627f693e36
|
@ -176,6 +176,7 @@
|
||||||
* A bit of code clean-up.
|
* A bit of code clean-up.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define _DEFAULT_SOURCE
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
@ -454,6 +455,8 @@ void wmifs_routine(int argc, char **argv)
|
||||||
DrawActiveIFS(stat_devices[stat_current].name);
|
DrawActiveIFS(stat_devices[stat_current].name);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
struct timespec ts;
|
||||||
|
|
||||||
gettimeofday(&tv, NULL);
|
gettimeofday(&tv, NULL);
|
||||||
curtime = (tv.tv_sec - tv2.tv_sec) * 1000
|
curtime = (tv.tv_sec - tv2.tv_sec) * 1000
|
||||||
+ (tv.tv_usec - tv2.tv_usec) / 1000;
|
+ (tv.tv_usec - tv2.tv_usec) / 1000;
|
||||||
|
@ -565,8 +568,9 @@ void wmifs_routine(int argc, char **argv)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ts.tv_sec = 0;
|
||||||
usleep(SampleInt * 1000);
|
ts.tv_nsec = SampleInt * 1000000;
|
||||||
|
nanosleep(&ts, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue