[INTERPRETER]

* BUG: Fix DateDiff() day comparison when comparing two dates with 
  different times.

git-svn-id: svn://localhost/gambas/trunk@7224 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Adrien Prokopowicz 2015-08-14 09:57:54 +00:00
parent a327fcb807
commit 0a8f1d9072

View file

@ -764,9 +764,9 @@ int DATE_diff(VALUE *date1, VALUE *date2, int period)
case DP_DAY:
case DP_WEEK:
diff = date1->_date.date - date2->_date.date;
sdiff = lsgn(diff);
if (sdiff != lsgn(date1->_date.time - date2->_date.time))
diff -= sdiff;
sdiff = lsgn(date1->_date.time - date2->_date.time);
if (sdiff != lsgn(diff))
diff += sdiff;
break;
case DP_MILLISECOND:
@ -786,9 +786,9 @@ int DATE_diff(VALUE *date1, VALUE *date2, int period)
case DP_WEEKDAY:
diff = date1->_date.date - date2->_date.date;
sdiff = lsgn(diff);
if (sdiff != lsgn(date1->_date.time - date2->_date.time))
diff -= sdiff;
sdiff = lsgn(date1->_date.time - date2->_date.time);
if (sdiff != lsgn(diff))
diff += sdiff;
ds1 = *DATE_split(date1);
ds2 = *DATE_split(date2);
break;