[PATCH] Fix build on fedora and debian by checking _POSIX_C_SOURCE

Arnaud Versini (via Code Review) gerrit at gerrit.libreoffice.org
Mon May 13 11:27:21 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3889

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/89/3889/1

Fix build on fedora and debian by checking _POSIX_C_SOURCE

Change-Id: I12809d970d0a2a4ebb946675f904832ff37e029f
---
M sal/osl/unx/time.c
1 file changed, 8 insertions(+), 2 deletions(-)



diff --git a/sal/osl/unx/time.c b/sal/osl/unx/time.c
index c99036b..7a2d355 100644
--- a/sal/osl/unx/time.c
+++ b/sal/osl/unx/time.c
@@ -24,6 +24,8 @@
 #include <osl/time.h>
 #include <time.h>
 
+#include <features.h>
+
 /* FIXME: detection should be done in configure script */
 #if defined(MACOSX) || defined(FREEBSD) || defined(NETBSD) || \
     defined(LINUX) || defined(OPENBSD) || defined(DRAGONFLY)
@@ -33,6 +35,10 @@
 #define HAS_ALTZONE 1
 #endif
 
+#if defined(LINUX) & (_POSIX_C_SOURCE >= 199309L)
+#define USE_CLOCK_GETTIME
+#endif
+
 /*--------------------------------------------------
  * osl_getSystemTime
  *-------------------------------------------------*/
@@ -40,7 +46,7 @@
 sal_Bool SAL_CALL osl_getSystemTime(TimeValue* tv)
 {
     int res;
-#if defined(LINUX)
+#if defined(USE_CLOCK_GETTIME)
     struct timespec tp;
 
     res = clock_gettime(CLOCK_REALTIME, &tp);
@@ -56,7 +62,7 @@
     }
 
     tv->Seconds = tp.tv_sec;
-    #if defined(LINUX)
+    #if defined(USE_CLOCK_GETTIME)
     tv->Nanosec = tp.tv_nsec;
     #else
     tv->Nanosec = tp.tv_usec * 1000;

-- 
To view, visit https://gerrit.libreoffice.org/3889
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I12809d970d0a2a4ebb946675f904832ff37e029f
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Arnaud Versini <arnaud.versini at gmail.com>



More information about the LibreOffice mailing list