In Windows the use of external variables timezone, tzname and daylight are deprecated...
authorHiroshi Inoue <h-inoue@dream.email.ne.jp>
Fri, 1 Apr 2016 09:48:06 +0000 (18:48 +0900)
committerHiroshi Inoue <h-inoue@dream.email.ne.jp>
Fri, 1 Apr 2016 10:45:05 +0000 (19:45 +0900)
convert.c

index 368b355130d1e9821ed5ee0cf195c588e8f95fe2..830910a334ff51403096dfe1f7fa8f23dbd4b3c4 100644 (file)
--- a/convert.c
+++ b/convert.c
@@ -54,10 +54,14 @@ CSTR    NAN_STRING = "NaN";
 CSTR   INFINITY_STRING = "Infinity";
 CSTR   MINFINITY_STRING = "-Infinity";
 
-#ifdef __CYGWIN__
+#if    defined(WIN32) || defined(__CYGWIN__)
 #define TIMEZONE_GLOBAL _timezone
-#elif  defined(WIN32) || defined(HAVE_INT_TIMEZONE)
+#define TZNAME_GLOBAL _tzname
+#define DAYLIGHT_GLOBAL _daylight
+#elif  defined(HAVE_INT_TIMEZONE)
 #define TIMEZONE_GLOBAL timezone
+#define TZNAME_GLOBAL tzname
+#define DAYLIGHT_GLOBAL daylight
 #endif
 
 /*
@@ -352,13 +356,13 @@ timestamp2stime(const char *str, SIMPLE_TIME *st, BOOL *bZone, int *zone)
    if (!withZone || !*bZone || st->y < 1970)
        return TRUE;
 #ifdef TIMEZONE_GLOBAL
-   if (!tzname[0] || !tzname[0][0])
+   if (!TZNAME_GLOBAL[0] || !TZNAME_GLOBAL[0][0])
    {
        *bZone = FALSE;
        return TRUE;
    }
    timediff = TIMEZONE_GLOBAL + (*zone) * 3600;
-   if (!daylight && timediff == 0)     /* the same timezone */
+   if (!DAYLIGHT_GLOBAL && timediff == 0)      /* the same timezone */
        return TRUE;
    else
    {
@@ -436,14 +440,14 @@ stime2timestamp(const SIMPLE_TIME *st, char *str, size_t bufsize, BOOL bZone,
    }
    zonestr[0] = '\0';
 #ifdef TIMEZONE_GLOBAL
-   if (bZone && tzname[0] && tzname[0][0] && st->y >= 1970)
+   if (bZone && TZNAME_GLOBAL[0] && TZNAME_GLOBAL[0][0] && st->y >= 1970)
    {
        long        zoneint;
        struct tm   tm;
        time_t      time0;
 
        zoneint = TIMEZONE_GLOBAL;
-       if (daylight && st->y >= 1900)
+       if (DAYLIGHT_GLOBAL && st->y >= 1900)
        {
            tm.tm_year = st->y - 1900;
            tm.tm_mon = st->m - 1;