diff lib/timespec.h @ 17024:fc5763921b7d

timespec: use extern-inline * lib/timespec.c: New file. * lib/timespec.h: Use _GL_INLINE_HEADER_BEGIN, _GL_INLINE_HEADER_END. (_GL_TIMESPEC_INLINE): New macro. Use it instead of 'static inline'. * modules/timespec (Files): Add lib/timespec.c. (Depends-on): Add extern-inline. (lib_SOURCES): Add timespec.c.
author Paul Eggert <eggert@cs.ucla.edu>
date Sat, 28 Jul 2012 07:18:23 -0700
parents 7b9ea0c1be5a
children ce2683fe3994
line wrap: on
line diff
--- a/lib/timespec.h
+++ b/lib/timespec.h
@@ -21,6 +21,8 @@
 
 # include <time.h>
 
+_GL_INLINE_HEADER_BEGIN
+
 /* Return negative, zero, positive if A < B, A == B, A > B, respectively.
 
    For each time stamp T, this code assumes that either:
@@ -49,7 +51,11 @@
 
    The (int) cast avoids a gcc -Wconversion warning.  */
 
-static inline int
+#ifndef _GL_TIMESPEC_INLINE
+# define _GL_TIMESPEC_INLINE _GL_INLINE
+#endif
+
+_GL_TIMESPEC_INLINE int
 timespec_cmp (struct timespec a, struct timespec b)
 {
   return (a.tv_sec < b.tv_sec ? -1
@@ -59,7 +65,7 @@
 
 /* Return -1, 0, 1, depending on the sign of A.  A.tv_nsec must be
    nonnegative.  */
-static inline int
+_GL_TIMESPEC_INLINE int
 timespec_sign (struct timespec a)
 {
   return a.tv_sec < 0 ? -1 : a.tv_sec || a.tv_nsec;
@@ -73,7 +79,7 @@
   _GL_ATTRIBUTE_CONST;
 
 /* Return an approximation to A, of type 'double'.  */
-static inline double
+_GL_TIMESPEC_INLINE double
 timespectod (struct timespec a)
 {
   return a.tv_sec + a.tv_nsec / 1e9;
@@ -82,4 +88,6 @@
 void gettime (struct timespec *);
 int settime (struct timespec const *);
 
+_GL_INLINE_HEADER_END
+
 #endif