X-Git-Url: https://git.xinqibao.xyz/slstatus.git/blobdiff_plain/9c9ce8a125f35bab61c829bdd58bdf77b8352d5e..0c29fc56f992a1eb74fadea361180d77af262ee5:/slstatus.c diff --git a/slstatus.c b/slstatus.c index 9bd9e81..7776fd5 100644 --- a/slstatus.c +++ b/slstatus.c @@ -36,13 +36,13 @@ difftimespec(struct timespec *res, struct timespec *a, struct timespec *b) { res->tv_sec = a->tv_sec - b->tv_sec - (a->tv_nsec < b->tv_nsec); res->tv_nsec = a->tv_nsec - b->tv_nsec + - (a->tv_nsec < b->tv_nsec) * 1000000000; + (a->tv_nsec < b->tv_nsec) * 1E9; } static void usage(void) { - die("usage: %s [-so]", argv0); + die("usage: %s [-s]", argv0); } int @@ -51,18 +51,15 @@ main(int argc, char *argv[]) struct sigaction act; struct timespec start, current, diff, intspec, wait; size_t i, len; - int sflag, oflag, ret; + int sflag, ret; char status[MAXLEN]; const char *res; - sflag = oflag = 0; + sflag = 0; ARGBEGIN { case 's': sflag = 1; break; - case 'o': - oflag = 1; - break; default: usage(); } ARGEND @@ -112,10 +109,6 @@ main(int argc, char *argv[]) XFlush(dpy); } - if (oflag) { - done = 1; - } - if (!done) { if (clock_gettime(CLOCK_MONOTONIC, ¤t) < 0) { die("clock_gettime:"); @@ -123,7 +116,7 @@ main(int argc, char *argv[]) difftimespec(&diff, ¤t, &start); intspec.tv_sec = interval / 1000; - intspec.tv_nsec = (interval % 1000) * 1000000; + intspec.tv_nsec = (interval % 1000) * 1E6; difftimespec(&wait, &intspec, &diff); if (wait.tv_sec >= 0) {