* lib/timespec.h (timespec_sign): New inline function.
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 30 Jun 2011 22:04:56 +0000 (15:04 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 30 Jun 2011 22:24:36 +0000 (15:24 -0700)
ChangeLog
lib/timespec.h

index e68d676..31e04e8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2011-06-30  Paul Eggert  <eggert@cs.ucla.edu>
 
+       * lib/timespec.h (timespec_sign): New inline function.
+
        pselect: new module
        * lib/sys_select.in.h: Include <signal.h>, for 'sigset_t'.
        (pselect): New decls.
index 74d5749..d5b0996 100644 (file)
@@ -57,6 +57,14 @@ timespec_cmp (struct timespec a, struct timespec b)
           : (int) (a.tv_nsec - b.tv_nsec));
 }
 
+/* Return -1, 0, 1, depending on the sign of A.  A.tv_nsec must be
+   nonnegative.  */
+static inline int
+timespec_sign (struct timespec a)
+{
+  return a.tv_sec < 0 ? -1 : a.tv_sec || a.tv_nsec;
+}
+
 void gettime (struct timespec *);
 int settime (struct timespec const *);