aboutsummaryrefslogtreecommitdiff
path: root/manual/examples/timespec_subtract.c
diff options
context:
space:
mode:
Diffstat (limited to 'manual/examples/timespec_subtract.c')
-rw-r--r--manual/examples/timespec_subtract.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/manual/examples/timespec_subtract.c b/manual/examples/timespec_subtract.c
index 380d173..2660740 100644
--- a/manual/examples/timespec_subtract.c
+++ b/manual/examples/timespec_subtract.c
@@ -22,12 +22,12 @@
bool
timespec_subtract (struct timespec *r,
- struct timespec x, struct timespec y)
+ struct timespec x, struct timespec y)
{
- /* Compute nanoseconds, setting @var{borrow} to 1, 0, or -1
+ /* Compute nanoseconds, setting @var{borrow} to 1 or 0
for propagation into seconds. */
long int nsec_diff = x.tv_nsec - y.tv_nsec;
- int borrow = (nsec_diff < 0) - ! (nsec_diff < 1000000000);
+ bool borrow = nsec_diff < 0;
r->tv_nsec = nsec_diff + 1000000000 * borrow;
/* Compute seconds, returning true if this overflows. */