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

index 31e04e8..0f37252 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,6 @@
 2011-06-30  Paul Eggert  <eggert@cs.ucla.edu>
 
-       * 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'.
index d5b0996..071f3a1 100644 (file)
@@ -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 *);