bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* [PATCH 1/5] * lib/timespec.h (timespec_sign): New inline function.
@ 2011-06-30 22:28 Paul Eggert
  0 siblings, 0 replies; only message in thread
From: Paul Eggert @ 2011-06-30 22:28 UTC (permalink / raw
  To: Bug-gnulib

---
 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  <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.
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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-06-30 22:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-30 22:28 [PATCH 1/5] * lib/timespec.h (timespec_sign): New inline function Paul Eggert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).