Discussion:
stat-time, timespec: support use in C++
(too old to reply)
Bruno Haible
2017-03-17 23:44:06 UTC
Permalink
Raw Message
Trivial change, to make these modules usable in C++ mode.


2017-03-17 Bruno Haible <***@clisp.org>

stat-time, timespec: Support use of the header files in C++ mode.
* lib/stat-time.h: Add "C" linkage declaration.
* lib/timespec.h: Likewise.

diff --git a/ChangeLog b/ChangeLog
index 7087aaf..b0529b5 100644
diff --git a/lib/stat-time.h b/lib/stat-time.h
index 9402b3f..4746989 100644
--- a/lib/stat-time.h
+++ b/lib/stat-time.h
@@ -31,6 +31,10 @@ _GL_INLINE_HEADER_BEGIN
# define _GL_STAT_TIME_INLINE _GL_INLINE
#endif

+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* STAT_TIMESPEC (ST, ST_XTIM) is the ST_XTIM member for *ST of type
struct timespec, if available. If not, then STAT_TIMESPEC_NS (ST,
ST_XTIM) is the nanosecond component of the ST_XTIM member for *ST,
@@ -194,6 +198,10 @@ get_stat_birthtime (struct stat const *st)
return t;
}

+#ifdef __cplusplus
+}
+#endif
+
_GL_INLINE_HEADER_END

#endif
diff --git a/lib/timespec.h b/lib/timespec.h
index a5eca79..f5d823a 100644
--- a/lib/timespec.h
+++ b/lib/timespec.h
@@ -29,6 +29,10 @@ _GL_INLINE_HEADER_BEGIN
# define _GL_TIMESPEC_INLINE _GL_INLINE
#endif

+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Resolution of timespec timestamps (in units per second), and log
base 10 of the resolution. */

@@ -107,6 +111,10 @@ timespectod (struct timespec a)
void gettime (struct timespec *);
int settime (struct timespec const *);

+#ifdef __cplusplus
+}
+#endif
+
_GL_INLINE_HEADER_END

#endif

Loading...