[libxslt] FreeBSD portability fixes



commit bda37db361159222a9ecd05237c05b839c3f2654
Author: Pedro F. Giffuni <giffunip tutopia com>
Date:   Thu Aug 16 17:16:05 2012 +0800

    FreeBSD portability fixes
    
    Around behaviour and compile flags for localtime and EXSLT date support

 libexslt/date.c |    2 +-
 libxslt/extra.c |    5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/libexslt/date.c b/libexslt/date.c
index 05b11ed..b692bb4 100644
--- a/libexslt/date.c
+++ b/libexslt/date.c
@@ -28,7 +28,7 @@
 #include "config.h"
 #endif
 
-#if HAVE_LOCALTIME_R	/* _POSIX_SOURCE required by gnu libc */
+#if defined(HAVE_LOCALTIME_R) && defined(__GLIBC__)	/* _POSIX_SOURCE required by gnu libc */
 #ifndef _AIX51		/* but on AIX we're not using gnu libc */
 #define _POSIX_SOURCE
 #endif
diff --git a/libxslt/extra.c b/libxslt/extra.c
index 3a0f547..f00b001 100644
--- a/libxslt/extra.c
+++ b/libxslt/extra.c
@@ -243,8 +243,11 @@ xsltFunctionLocalTime(xmlXPathParserContextPtr ctxt, int nargs) {
      * Calling localtime() has the side-effect of setting timezone.
      * After we know the timezone, we can adjust for it
      */
+#if !defined(__FreeBSD__)
     lmt = gmt - timezone;
-
+#else	/* FreeBSD DOESN'T have such side-ffect */
+    lmt = gmt - local_tm->tm_gmtoff;
+#endif
     /*
      * FIXME: it's been too long since I did manual memory management.
      * (I swore never to do it again.) Does this introduce a memory leak?



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]