Changeset: a78bffe61d15 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a78bffe61d15 Modified Files: monetdb5/modules/atoms/mtime.c Branch: default Log Message:
Fix dayofweek calculation for negative dates. diffs (17 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 @@ -427,7 +427,12 @@ parse_substr(int *ret, str s, int min, s return j; } -#define date_dayofweek(v) (((v) - 1) % 7 + 1) +static int +date_dayofweek(date v) +{ + v %= 7; + return v <= 0 ? v + 7 : v; +} #define SKIP_DAYS(d,w,i) d += i; w = (w + i)%7; if (w <= 0) w += 7; _______________________________________________ Checkin-list mailing list Checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list