Changeset: c04ddfe6a7cf for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c04ddfe6a7cf
Modified Files:
monetdb5/modules/atoms/mtime.c
Branch: timezone
Log Message:
Take parsed time zone into account (if we can, i.e. on Linux).
diffs (25 lines):
diff --git a/monetdb5/modules/atoms/mtime.c b/monetdb5/modules/atoms/mtime.c
--- a/monetdb5/modules/atoms/mtime.c
+++ b/monetdb5/modules/atoms/mtime.c
@@ -1809,6 +1809,10 @@ MTIMEstr_to_time(daytime *ret, const cha
if (strptime(*s, *format, &tm) == NULL)
throw(MAL, "mtime.str_to_time", "format '%s', doesn't match
time '%s'",
*format, *s);
+#ifdef HAVE_STRUCT_TM_TM_ZONE
+ tm.tm_sec -= tm.tm_gmtoff;
+ tm.tm_sec += tm.tm_gmtoff = local_timezone(NULL);
+#endif
if ((t = mktime(&tm)) == (time_t) -1)
throw(MAL, "mtime.str_to_time", "cannot convert to time_t");
tm = (struct tm) {0};
@@ -1841,6 +1845,10 @@ MTIMEstr_to_timestamp(timestamp *ret, co
if (strptime(*s, *format, &tm) == NULL)
throw(MAL, "mtime.str_to_timestamp",
"format '%s', doesn't match timestamp '%s'", *format,
*s);
+#ifdef HAVE_STRUCT_TM_TM_ZONE
+ tm.tm_sec -= tm.tm_gmtoff;
+ tm.tm_sec += tm.tm_gmtoff = local_timezone(NULL);
+#endif
if ((t = mktime(&tm)) == (time_t) -1)
throw(MAL, "mtime.str_to_timestamp", "cannot convert to
time_t");
tm = (struct tm) {0};
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list