all repos — slstatus @ 862d158b7c3f1bd138c00e1bd29de87d3fc89f15

my build of slstatus (tools.suckless.org/slstatus/)

fix delay in a cleaner way
raiz raiz@firemail.cc
Tue, 27 Dec 2016 19:12:39 +0300
commit

862d158b7c3f1bd138c00e1bd29de87d3fc89f15

parent

6cab2d57199edd8cc9e292ded04558fe9279962b

1 files changed, 9 insertions(+), 4 deletions(-)

jump to
M slstatus.cslstatus.c

@@ -75,7 +75,7 @@ static void usage(void);

char *argv0; char concat[]; -static unsigned short int delay; +static unsigned short int delay = 0; static unsigned short int done; static unsigned short int dflag, oflag; static Display *dpy;

@@ -164,7 +164,7 @@ }

fscanf(fp, "%*s %Lf %Lf %Lf %Lf", &a[0], &a[1], &a[2], &a[3]); fclose(fp); - delay = (UPDATE_INTERVAL - (UPDATE_INTERVAL - 1)); + delay++; sleep(delay); fp = fopen("/proc/stat", "r");

@@ -829,8 +829,13 @@ /*

* subtract delay time spend in function * calls from the actual global delay time */ - sleep(UPDATE_INTERVAL - delay); - delay = 0; + if ((UPDATE_INTERVAL - delay) <= 0) { + delay = 0; + continue; + } else { + sleep(UPDATE_INTERVAL - delay); + delay = 0; + } } if (!oflag) {