Changeset: 3df0b5deae76 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/3df0b5deae76
Modified Files:
        monetdb5/modules/atoms/mtime.c
Branch: Sep2022
Log Message:

use clean tm record ie such that half filled in dates get set to the first of a 
period, first of month, first month of the year
etc


diffs (21 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
@@ -930,16 +930,14 @@ static str
 str_to_timestamp(timestamp *ret, str *s, str *format, const char *type, const 
char *malfunc)
 {
        struct tm tm = (struct tm) {0};
-       time_t t;
 
        if (strNil(*s) || strNil(*format)) {
                *ret = timestamp_nil;
                return MAL_SUCCEED;
        }
-       t = time(NULL);
-       localtime_r(&t, &tm);
        tm.tm_sec = tm.tm_min = tm.tm_hour = 0;
        tm.tm_isdst = -1;
+       tm.tm_mday = 1;
        if (strptime(*s, *format, &tm) == NULL)
                throw(MAL, malfunc,
                          "format '%s', doesn't match %s '%s'", *format, type, 
*s);
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to