summaryrefslogtreecommitdiff
path: root/sql-common
diff options
context:
space:
mode:
authorSergey Glukhov <sergey.glukhov@oracle.com>2011-04-27 11:46:23 +0400
committerSergey Glukhov <sergey.glukhov@oracle.com>2011-04-27 11:46:23 +0400
commit75f02c36ce158b58d6e7da8b98ccd2e0b1426758 (patch)
tree2a80f211f0c197a787a8029a6b7112f19828970e /sql-common
parentb4c9402fabe17e4a3cf425a148faa24c470fb2dd (diff)
parent735bab72c51e0ff4ccf5fb688826e87931ee8fe2 (diff)
downloadmariadb-git-75f02c36ce158b58d6e7da8b98ccd2e0b1426758.tar.gz
5.1 -> 5.5 merge
Diffstat (limited to 'sql-common')
-rw-r--r--sql-common/my_time.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql-common/my_time.c b/sql-common/my_time.c
index 39eee57a1c0..de88e8756b5 100644
--- a/sql-common/my_time.c
+++ b/sql-common/my_time.c
@@ -772,7 +772,7 @@ long calc_daynr(uint year,uint month,uint day)
int y= year; /* may be < 0 temporarily */
DBUG_ENTER("calc_daynr");
- if (y == 0 && month == 0 && day == 0)
+ if (y == 0 && month == 0)
DBUG_RETURN(0); /* Skip errors */
/* Cast to int to be able to handle month == 0 */
delsum= (long) (365 * y + 31 *((int) month - 1) + (int) day);
@@ -783,6 +783,7 @@ long calc_daynr(uint year,uint month,uint day)
temp=(int) ((y/100+1)*3)/4;
DBUG_PRINT("exit",("year: %d month: %d day: %d -> daynr: %ld",
y+(month <= 2),month,day,delsum+y/4-temp));
+ DBUG_ASSERT(delsum+(int) y/4-temp > 0);
DBUG_RETURN(delsum+(int) y/4-temp);
} /* calc_daynr */