Hi Paul,

There were a couple "999999999" left in timespec-related files, so I
propose to replace them, taking advantage of your new
TIMESPEC_RESOLUTION symbol.
There were a couple more in comments, but it didn't seem worthwhile to
replace those.
From 18c79660af8364a86e8da7c62a89b2287b159afd Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyer...@fb.com>
Date: Sat, 21 Sep 2013 09:11:49 -0700
Subject: [PATCH] timespec: use the new TIMESPEC_RESOLUTION in a few more
 places

* lib/timespec-add.c (timespec_add): Also replace 999999999
with TIMESPEC_RESOLUTION - 1.
* lib/timespec-sub.c (timespec_sub): Likewise.
---
 ChangeLog          | 7 +++++++
 lib/timespec-add.c | 4 ++--
 lib/timespec-sub.c | 6 +++---
 3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3777fc7..b42fad4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2013-09-21  Jim Meyering  <meyer...@fb.com>
+
+       timespec: use the new TIMESPEC_RESOLUTION in a few more places
+       * lib/timespec-add.c (timespec_add): Also replace 999999999
+       with TIMESPEC_RESOLUTION - 1.
+       * lib/timespec-sub.c (timespec_sub): Likewise.
+
 2013-09-19  Pádraig Brady  <p...@draigbrady.com>

        userspec: support optional parameters to parse_user_spec()
diff --git a/lib/timespec-add.c b/lib/timespec-add.c
index 51323a6..d628237 100644
--- a/lib/timespec-add.c
+++ b/lib/timespec-add.c
@@ -18,7 +18,7 @@
 /* Written by Paul Eggert.  */

 /* Return the sum of two timespec values A and B.  On overflow, return
-   an extremal value.  This assumes 0 <= tv_nsec <= 999999999.  */
+   an extremal value.  This assumes 0 <= tv_nsec < TIMESPEC_RESOLUTION.  */

 #include <config.h>
 #include "timespec.h"
@@ -58,7 +58,7 @@ timespec_add (struct timespec a, struct timespec b)
         {
         high_overflow:
           rs = TYPE_MAXIMUM (time_t);
-          rns = 999999999;
+          rns = TIMESPEC_RESOLUTION - 1;
         }
     }
   else
diff --git a/lib/timespec-sub.c b/lib/timespec-sub.c
index b164a83..3f3adea 100644
--- a/lib/timespec-sub.c
+++ b/lib/timespec-sub.c
@@ -18,8 +18,8 @@
 /* Written by Paul Eggert.  */

 /* Return the difference between two timespec values A and B.  On
-   overflow, return an extremal value.  This assumes 0 <= tv_nsec <=
-   999999999.  */
+   overflow, return an extremal value.  This assumes 0 <= tv_nsec <
+   TIMESPEC_RESOLUTION.  */

 #include <config.h>
 #include "timespec.h"
@@ -58,7 +58,7 @@ timespec_sub (struct timespec a, struct timespec b)
       else
         {
           rs = TYPE_MAXIMUM (time_t);
-          rns = 999999999;
+          rns = TIMESPEC_RESOLUTION - 1;
         }
     }
   else
-- 
1.8.4.299.gb3e7d24

Reply via email to