Changeset: 3962b14fdee5 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3962b14fdee5
Modified Files:
        NT/monetdb_config.h.in
        clients/mapiclient/mclient.c
        configure.ag
        monetdb5/optimizer/opt_mergetable.c
        sql/backends/monet5/sql_gencode.c
Branch: default
Log Message:

Merge with Jun2016 branch.


diffs (107 lines):

diff --git a/NT/monetdb_config.h.in b/NT/monetdb_config.h.in
--- a/NT/monetdb_config.h.in
+++ b/NT/monetdb_config.h.in
@@ -187,6 +187,11 @@
 /* Define to 1 if you have the `getaddrinfo' function. */
 #define HAVE_GETADDRINFO 1
 
+/* Define to 1 if you have the `GetDynamicTimeZoneInformation' function. */
+#ifdef _MSC_VER
+#define HAVE_GETDYNAMICTIMEZONEINFORMATION 1
+#endif
+
 /* Define to 1 if you have the `getexecname' function. */
 /* #undef HAVE_GETEXECNAME */
 
@@ -205,11 +210,6 @@
 /* Define to 1 if you have the `gettimeofday' function. */
 /* #undef HAVE_GETTIMEOFDAY */
 
-/* Define to 1 if you have the `_get_timezone' function. */
-#ifdef _MSC_VER
-#define HAVE__GET_TIMEZONE 1
-#endif
-
 /* Define to 1 if you have the `getuid' function. */
 /* #undef HAVE_GETUID */
 
diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -2849,15 +2849,33 @@ set_timezone(Mapi mid)
        MapiHdl hdl;
 
        /* figure out our current timezone */
-#ifdef HAVE__GET_TIMEZONE
-       __time64_t ltime, lt, gt;
-       struct tm loctime;
+#if defined HAVE_GETDYNAMICTIMEZONEINFORMATION
+       DYNAMIC_TIME_ZONE_INFORMATION tzinf;
 
-       _time64(&ltime);
-       _localtime64_s(&loctime, &ltime);
-       lt = _mktime64(&loctime);
-       gt = _mkgmtime64(&loctime);
-       tzone = (int) (lt - gt);
+       /* documentation says: UTC = localtime + Bias (in minutes),
+        * but experimentation during DST period says, UTC = localtime
+        * + Bias + DaylightBias, and presumably during non DST
+        * period, UTC = localtime + Bias */
+       switch (GetDynamicTimeZoneInformation(&tzinf)) {
+       case TIME_ZONE_ID_STANDARD:
+       case TIME_ZONE_ID_UNKNOWN:
+               tzone = (int) tzinf.Bias * 60;
+               break;
+       case TIME_ZONE_ID_DAYLIGHT:
+               tzone = (int) (tzinf.Bias + tzinf.DaylightBias) * 60;
+               break;
+       default:
+               /* call failed, we don't know the time zone */
+               tzone = 0;
+               break;
+       }
+#elif defined HAVE_STRUCT_TM_TM_ZONE
+       time_t t;
+       struct tm *tmp;
+
+       t = time(NULL);
+       tmp = localtime(&t);
+       tzone = (int) -tmp->tm_gmtoff;
 #else
        time_t t, lt, gt;
        struct tm *tmp;
diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -3193,6 +3193,8 @@ if test $mn_cv_have__sys_siglist = yes; 
        AC_DEFINE(HAVE__SYS_SIGLIST, 1, [Define if you have _sys_siglist])
 fi
 
+AC_STRUCT_TIMEZONE
+
 dnl check dependencies (might need more than just SQL)
 if test x"$enable_sql" = xyes && test x"$enable_monetdb5" = x"no" ; then
        AC_MSG_ERROR([MonetDB/SQL requires MonetDB5${disable_monetdb5:+ 
$disable_monetdb5}.])
diff --git a/monetdb5/optimizer/opt_mergetable.c 
b/monetdb5/optimizer/opt_mergetable.c
--- a/monetdb5/optimizer/opt_mergetable.c
+++ b/monetdb5/optimizer/opt_mergetable.c
@@ -713,7 +713,7 @@ mat_joinNxM(Client cntxt, MalBlkPtr mb, 
                int mv1 = mats[0], i;
                int mv2 = mats[args-1];
                int split = subjoin_split(cntxt, p, args);
-               int nr_mv1 = split, nr_mv2 = nr_mats-split;
+               int nr_mv1 = split;
 
                if (split < 0) {
                        GDKfree(mats);
@@ -729,8 +729,8 @@ mat_joinNxM(Client cntxt, MalBlkPtr mb, 
                                getArg(q,1) = newTmpVariable(mb, tpe);
                                for (i = 0; i < nr_mv1; i++ )
                                        getArg(q,q->retc+i) = 
getArg(mat[mats[i]].mi,k);
-                               for (i = 0; i < nr_mv2; i++ )
-                                       getArg(q,q->retc+split+i) = 
getArg(mat[mats[i]].mi,k);
+                               for (; i < nr_mats; i++ )
+                                       getArg(q,q->retc+i) = 
getArg(mat[mats[i]].mi,j);
                                pushInstruction(mb,q);
        
                                propagatePartnr(ml, getArg(mat[mv1].mi, k), 
getArg(q,0), nr);
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to