diff --git a/dwmblocks.c b/dwmblocks.c index ce68340..169a31d 100644 --- a/dwmblocks.c +++ b/dwmblocks.c @@ -4,6 +4,7 @@ #include #include #include +#include #ifndef NO_X #include #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) {