diff lib/timespec.h @ 15331:d214a85acda4

* lib/timespec.h (timespectod): New inline function.
author Paul Eggert <eggert@cs.ucla.edu>
date Thu, 30 Jun 2011 15:06:54 -0700 (2011-06-30)
parents 15ab18909697
children c762e3063952
line wrap: on
line diff
--- a/lib/timespec.h
+++ b/lib/timespec.h
@@ -65,6 +65,13 @@
   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 *);