Fix wait time
This commit is contained in:
parent
c37f05bc35
commit
5400dcfc75
@ -4,6 +4,7 @@
|
||||
#include<unistd.h>
|
||||
#include<signal.h>
|
||||
#include <time.h>
|
||||
#include <math.h>
|
||||
#ifndef NO_X
|
||||
#include<X11/Xlib.h>
|
||||
#endif
|
||||
@ -167,7 +168,10 @@ void statusloop() {
|
||||
}
|
||||
int i = 0;
|
||||
getcmds(-1);
|
||||
const struct timespec sleeptime = { 0, interval * 1000000 };
|
||||
long nsec_part = interval * 1000000;
|
||||
time_t sec_part = floor(nsec_part / 1000000000.0);
|
||||
nsec_part -= sec_part * 1000000000l;
|
||||
const struct timespec sleeptime = { sec_part, nsec_part };
|
||||
struct timespec tosleep = sleeptime;
|
||||
while (statuscontinue) {
|
||||
if (nanosleep(&tosleep, &tosleep) < 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user