]> granicus.if.org Git - rtmpdump/commitdiff
Portability fixes
authorhyc <hyc@400ebc74-4327-4243-bc38-086b20814532>
Sun, 21 Feb 2010 04:47:22 +0000 (04:47 +0000)
committerhyc <hyc@400ebc74-4327-4243-bc38-086b20814532>
Sun, 21 Feb 2010 04:47:22 +0000 (04:47 +0000)
git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@265 400ebc74-4327-4243-bc38-086b20814532

hashswf.c
rtmpsrv.c

index 2e57f01814f442d742588799c69cfddda5ab6433..814a6839c7ab5f10d7ad472be313b778e49ce4a0 100644 (file)
--- a/hashswf.c
+++ b/hashswf.c
@@ -260,6 +260,11 @@ leave:
   return ret;
 }
 
+static int tzoff;
+static int tzchecked;
+
+#define        JAN02_1980      318340800
+
 static const char *monthtab[12] = {"Jan", "Feb", "Mar",
                                "Apr", "May", "Jun",
                                "Jul", "Aug", "Sep",
@@ -321,12 +326,24 @@ make_unix_time(char *s)
            break;
        }
     time.tm_isdst = 0;         /* daylight saving is never in effect in GMT */
+
+    /* this is normally the value of extern int timezone, but some
+     * braindead C libraries don't provide it.
+     */
+    if (!tzchecked)
+    {
+       struct tm *tc;
+       time_t then = JAN02_1980;
+       tc = localtime(&then);
+       tzoff = (12 - tc->tm_hour) * 3600 + tc->tm_min * 60 + tc->tm_sec;
+       tzchecked = 1;
+    }
     res = mktime(&time);
     /* Unfortunately, mktime() assumes the input is in local time,
      * not GMT, so we have to correct it here.
      */
     if (res != -1)
-       res += timezone;
+       res += tzoff;
     return res;
 }
 
index 7026fe8c6d231d80e4ffcb68ed4544aae83046cd..534d9c72a5f34c9175d08df17d1478b2419c5f44 100644 (file)
--- a/rtmpsrv.c
+++ b/rtmpsrv.c
 #include "thread.h"
 
 #ifdef linux
+#include <linux/netfilter_ipv4.h>
+#endif
+
+#ifndef WIN32
 #include <sys/types.h>
 #include <sys/wait.h>
-#include <linux/netfilter_ipv4.h>
 #endif
 
 #define RD_SUCCESS             0