bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/5] * lib/timespec.h (timespec_sign): New inline function.


From: Paul Eggert
Subject: [PATCH 1/5] * lib/timespec.h (timespec_sign): New inline function.
Date: Thu, 30 Jun 2011 15:28:12 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Thunderbird/3.1.10

---
 ChangeLog      |    2 ++
 lib/timespec.h |    8 ++++++++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e68d676..31e04e8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2011-06-30  Paul Eggert  <address@hidden>
 
+       * 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.
diff --git a/lib/timespec.h b/lib/timespec.h
index 74d5749..d5b0996 100644
--- a/lib/timespec.h
+++ b/lib/timespec.h
@@ -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 *);
 
-- 
1.7.4.4



reply via email to

[Prev in Thread] Current Thread [Next in Thread]