fixed FreeBSD build

Sat, 23 Jan 2016 19:04:08 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sat, 23 Jan 2016 19:04:08 +0100
changeset 184
7ba3c97b31ff
parent 183
c238e0017257
child 185
cd42cccee550

fixed FreeBSD build

libidav/utils.c file | annotate | diff | comparison | revisions
--- a/libidav/utils.c	Sun Jan 17 18:45:17 2016 +0100
+++ b/libidav/utils.c	Sat Jan 23 19:04:08 2016 +0100
@@ -136,7 +136,11 @@
         tparts.tm_isdst = -1;
         return mktime(&tparts);
     } else if(!sstrcmp(tzinfo, S("Z"))) {
+#ifdef __FreeBSD__
+        return timegm(&tparts);
+#else
         return mktime(&tparts) - timezone;
+#endif
     } else if(tzinfo.ptr[0] == '+' || tzinfo.ptr[0] == '-') {
         int sign = (tzinfo.ptr[0] == '+') ? -1 : 1;
 
@@ -147,8 +151,11 @@
             extractval(tzinfo, conv, ':');
             val = atol(conv);
             val = 60 * (val / 100) + (val % 100);
-
-            return mktime(&tparts) - timezone + (time_t) (60 * val * sign);
+#ifdef __FreeBSD__
+            return timegm(&tparts) + (time_t) (60 * val * sign);
+#else
+            return mktime(&tparts) - timezone + (time_t) (60 * val * sign);            
+#endif
         }
     } else {
         return 0;

mercurial