[INTERPRETER]
* BUG: DateDiff() correctly returns zero when asking for the number of days between two timestamps having the same date. git-svn-id: svn://localhost/gambas/trunk@7612 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
61064b6f6e
commit
056190b68d
1 changed files with 13 additions and 6 deletions
|
@ -764,10 +764,14 @@ int DATE_diff(VALUE *date1, VALUE *date2, int period)
|
||||||
{
|
{
|
||||||
case DP_DAY:
|
case DP_DAY:
|
||||||
case DP_WEEK:
|
case DP_WEEK:
|
||||||
|
fprintf(stderr, "DATE_diff: (%d %d) -> (%d %d)\n", date2->_date.date, date2->_date.time, date1->_date.date, date1->_date.time);
|
||||||
diff = date1->_date.date - date2->_date.date;
|
diff = date1->_date.date - date2->_date.date;
|
||||||
sdiff = lsgn(date1->_date.time - date2->_date.time);
|
if (diff)
|
||||||
if (sdiff != lsgn(diff))
|
{
|
||||||
diff += sdiff;
|
sdiff = lsgn(date1->_date.time - date2->_date.time);
|
||||||
|
if (sdiff != lsgn(diff))
|
||||||
|
diff += sdiff;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DP_MILLISECOND:
|
case DP_MILLISECOND:
|
||||||
|
@ -787,9 +791,12 @@ int DATE_diff(VALUE *date1, VALUE *date2, int period)
|
||||||
|
|
||||||
case DP_WEEKDAY:
|
case DP_WEEKDAY:
|
||||||
diff = date1->_date.date - date2->_date.date;
|
diff = date1->_date.date - date2->_date.date;
|
||||||
sdiff = lsgn(date1->_date.time - date2->_date.time);
|
if (diff)
|
||||||
if (sdiff != lsgn(diff))
|
{
|
||||||
diff += sdiff;
|
sdiff = lsgn(date1->_date.time - date2->_date.time);
|
||||||
|
if (sdiff != lsgn(diff))
|
||||||
|
diff += sdiff;
|
||||||
|
}
|
||||||
ds1 = *DATE_split(date1);
|
ds1 = *DATE_split(date1);
|
||||||
ds2 = *DATE_split(date2);
|
ds2 = *DATE_split(date2);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue