bug-gnulib
[Top][All Lists]
Advanced

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

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


From: Paul Eggert
Subject: [PATCH 2/5] * lib/timespec.h (timespectod): New inline function.
Date: Thu, 30 Jun 2011 15:28:19 -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 |    7 +++++++
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 31e04e8..0f37252 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,6 @@
 2011-06-30  Paul Eggert  <address@hidden>
 
-       * lib/timespec.h (timespec_sign): New inline function.
+       * lib/timespec.h (timespec_sign, timespectod): New inline functions.
 
        pselect: new module
        * lib/sys_select.in.h: Include <signal.h>, for 'sigset_t'.
diff --git a/lib/timespec.h b/lib/timespec.h
index d5b0996..071f3a1 100644
--- a/lib/timespec.h
+++ b/lib/timespec.h
@@ -65,6 +65,13 @@ timespec_sign (struct timespec a)
   return a.tv_sec < 0 ? -1 : a.tv_sec || a.tv_nsec;
 }
 
+/* Return an approximation to A, of type 'double'.  */
+static inline double
+timespectod (struct timespec a)
+{
+  return a.tv_sec + a.tv_nsec / 1e9;
+}
+
 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]