Changeset: b6c2194204ac for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b6c2194204ac
Modified Files:
NT/monetdb_config.h.in
clients/mapiclient/mclient.c
Branch: Jul2015
Log Message:
On Windows, use Windows-specific calls to get current timezone and DST.
diffs (49 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
@@ -205,6 +205,9 @@
/* Define to 1 if you have the `gettimeofday' function. */
/* #undef HAVE_GETTIMEOFDAY */
+/* Define to 1 if you have the `_get_timezone' function. */
+#define HAVE__GET_TIMEZONE 1
+
/* Define if you have the gsl library */
/* #undef HAVE_GSL */
diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -2909,12 +2909,22 @@ static void
set_timezone(Mapi mid)
{
char buf[128];
- time_t t, lt, gt;
- struct tm *tmp;
int tzone;
MapiHdl hdl;
/* figure out our current timezone */
+#ifdef HAVE__GET_TIMEZONE
+ long tz;
+ int dst;
+
+ _tzset();
+ _get_timezone(&tz);
+ _get_dstbias(&dst);
+ tzone = (int) (tz + dst);
+#else
+ time_t t, lt, gt;
+ struct tm *tmp;
+
t = time(NULL);
tmp = gmtime(&t);
gt = mktime(tmp);
@@ -2923,6 +2933,7 @@ set_timezone(Mapi mid)
lt = mktime(tmp);
assert((lng) gt - (lng) lt >= (lng) INT_MIN && (lng) gt - (lng) lt <=
(lng) INT_MAX);
tzone = (int) (gt - lt);
+#endif
if (tzone < 0)
snprintf(buf, sizeof(buf),
"SET TIME ZONE INTERVAL '+%02d:%02d' HOUR TO MINUTE",
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list