]> granicus.if.org Git - php/commitdiff
zts fixes
authorIlia Alshanetsky <iliaa@php.net>
Thu, 30 Nov 2006 16:38:53 +0000 (16:38 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Thu, 30 Nov 2006 16:38:53 +0000 (16:38 +0000)
ext/pdo_sqlite/sqlite/src/date.c
ext/sqlite/libsqlite/src/date.c
ext/xmlrpc/libxmlrpc/xmlrpc.c
ext/zip/lib/zip_dirent.c

index 91469061814b53a4738f13647f963c6fe1c3b9fa..b5c307424305beded6d77dfca6d9f1d8a23484e3 100644 (file)
@@ -53,6 +53,7 @@
 #include <stdlib.h>
 #include <assert.h>
 #include <time.h>
+#include "main/php_reentrancy.h"
 
 #ifndef SQLITE_OMIT_DATETIME_FUNCS
 
@@ -393,7 +394,7 @@ static void clearYMD_HMS_TZ(DateTime *p){
 static double localtimeOffset(DateTime *p){
   DateTime x, y;
   time_t t;
-  struct tm *pTm;
+  struct tm *pTm, tmbuf;
   x = *p;
   computeYMD_HMS(&x);
   if( x.Y<1971 || x.Y>=2038 ){
@@ -412,7 +413,8 @@ static double localtimeOffset(DateTime *p){
   computeJD(&x);
   t = (x.rJD-2440587.5)*86400.0 + 0.5;
   sqlite3OsEnterMutex();
-  pTm = localtime(&t);
+  pTm = php_localtime_r
+(&t, &tmbuf);
   y.Y = pTm->tm_year + 1900;
   y.M = pTm->tm_mon + 1;
   y.D = pTm->tm_mday;
index c7489ec078d9c5e8da0de0392699f7316d4df92e..f994e0769fc77db9e02a039667773f6d238b1479 100644 (file)
@@ -53,6 +53,7 @@
 #include <stdlib.h>
 #include <assert.h>
 #include <time.h>
+#include "main/php_reentrancy.h"
 
 #ifndef SQLITE_OMIT_DATETIME_FUNCS
 
@@ -397,7 +398,7 @@ static void clearYMD_HMS_TZ(DateTime *p){
 static double localtimeOffset(DateTime *p){
   DateTime x, y;
   time_t t;
-  struct tm *pTm;
+  struct tm *pTm, tmbuf;
   x = *p;
   computeYMD_HMS(&x);
   if( x.Y<1971 || x.Y>=2038 ){
@@ -416,7 +417,7 @@ static double localtimeOffset(DateTime *p){
   computeJD(&x);
   t = (x.rJD-2440587.5)*86400.0 + 0.5;
   sqliteOsEnterMutex();
-  pTm = localtime(&t);
+  pTm = php_localtime_r(&t, &tmbuf);
   y.Y = pTm->tm_year + 1900;
   y.M = pTm->tm_mon + 1;
   y.D = pTm->tm_mday;
index 4112216866cc7333cfb70e3740579de093c2c1f7..2a5600290b43aba75130e669b0c6d63ee904c181 100644 (file)
@@ -43,6 +43,9 @@ static const char rcsid[] = "#(@) $Id$";
  *   9/1999 - 10/2000
  * HISTORY
  *   $Log$
+ *   Revision 1.8  2005/03/28 00:07:24  edink
+ *   Reshufle includes to make it compile on windows
+ *
  *   Revision 1.7  2005/03/26 03:13:58  sniper
  *   - Made it possible to build ext/xmlrpc with libxml2
  *
@@ -123,6 +126,7 @@ static const char rcsid[] = "#(@) $Id$";
  *******/
 
 #include "ext/xml/expat_compat.h"
+#include "main/php_reentrancy.h"
 #ifdef _WIN32
 #include "xmlrpc_win32.h"
 #endif
@@ -227,8 +231,8 @@ static int date_from_ISO8601 (const char *text, time_t * value) {
 }
 
 static int date_to_ISO8601 (time_t value, char *buf, int length) {
-   struct tm *tm;
-   tm = localtime(&value);
+   struct tm *tm, tmbuf;
+   tm = php_localtime_r(&value, &tmbuf);
 #if 0  /* TODO: soap seems to favor this method. xmlrpc the latter. */
        return strftime (buf, length, "%Y-%m-%dT%H:%M:%SZ", tm);
 #else
index f0c988bc70d82bc3e72e441d93100c9356f32e8b..0eeb4ac561c71f500b5e3f49196ccf544c1f28ff 100644 (file)
@@ -33,8 +33,6 @@
   IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-\f
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -47,6 +45,7 @@
 
 #include "zip.h"
 #include "zipint.h"
+#include "main/php_reentrancy.h"
 
 static time_t _zip_d2u_time(int, int);
 static char *_zip_readfpstr(FILE *, unsigned int, int, struct zip_error *);
@@ -391,11 +390,11 @@ _zip_dirent_write(struct zip_dirent *zde, FILE *fp, int localp,
 static time_t
 _zip_d2u_time(int dtime, int ddate)
 {
-    struct tm *tm;
+    struct tm *tm, tmbuf;
     time_t now;
 
     now = time(NULL);
-    tm = localtime(&now);
+    tm = php_localtime_r(&now, &tmbuf);
     
     tm->tm_year = ((ddate>>9)&127) + 1980 - 1900;
     tm->tm_mon = ((ddate>>5)&15) - 1;
@@ -520,9 +519,9 @@ _zip_write4(unsigned int i, FILE *fp)
 static void
 _zip_u2d_time(time_t time, unsigned short *dtime, unsigned short *ddate)
 {
-    struct tm *tm;
+    struct tm *tm, tmbuf;
 
-    tm = localtime(&time);
+    tm = php_localtime_r(&time, &tmbuf);
     *ddate = ((tm->tm_year+1900-1980)<<9) + ((tm->tm_mon+1)<<5)
        + tm->tm_mday;
     *dtime = ((tm->tm_hour)<<11) + ((tm->tm_min)<<5)