summaryrefslogtreecommitdiff
path: root/src/sleep.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1999-12-27 16:30:20 +0000
committerJim Meyering <jim@meyering.net>1999-12-27 16:30:20 +0000
commit99c51ad97e041ffde3574016a7136297bd983977 (patch)
tree8899d27c03443a1ca10013577877ca57fc2da9ad /src/sleep.c
parent4c746d7a4c2dd633c2521e531b9676219b6431d8 (diff)
downloadcoreutils-99c51ad97e041ffde3574016a7136297bd983977.tar.xz
minor var. renamings
Diffstat (limited to 'src/sleep.c')
-rw-r--r--src/sleep.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/sleep.c b/src/sleep.c
index 57d2de778..977847771 100644
--- a/src/sleep.c
+++ b/src/sleep.c
@@ -111,8 +111,8 @@ apply_suffix (double *s, char suffix_char)
/* Subtract the `struct timespec' values X and Y,
storing the difference in DIFF.
- Return 1 if the difference is negative, otherwise 0.
- From the GNU libc manual. */
+ Return 1 if the difference is positive, otherwise 0.
+ Derived from code in the GNU libc manual. */
static int
timespec_subtract (struct timespec *diff,
@@ -138,8 +138,8 @@ timespec_subtract (struct timespec *diff,
diff->tv_sec = x->tv_sec - y->tv_sec;
diff->tv_nsec = x->tv_nsec - y->tv_nsec;
- /* Return 1 if result is negative. */
- return x->tv_sec < y->tv_sec;
+ /* Return 1 if result is positive. */
+ return y->tv_sec < x->tv_sec;
}
static void
@@ -247,13 +247,13 @@ main (int argc, char **argv)
{
struct timespec remaining;
struct timespec ts_now;
- int negative;
- int interrupted = nanosleep (&ts_sleep, &remaining);
- if (!interrupted)
+ int any_remaining;
+ int suspended = nanosleep (&ts_sleep, &remaining);
+ if (!suspended)
break;
clock_get_realtime (&ts_now);
- negative = timespec_subtract (&ts_sleep, &ts_stop, &ts_now);
- if (negative)
+ any_remaining = timespec_subtract (&ts_sleep, &ts_stop, &ts_now);
+ if (! any_remaining)
break;
}