summaryrefslogtreecommitdiff
path: root/sql-common
diff options
context:
space:
mode:
authorTatiana A. Nurnberg <azundris@mysql.com>2009-01-09 14:22:15 +0100
committerTatiana A. Nurnberg <azundris@mysql.com>2009-01-09 14:22:15 +0100
commitd3c4a5cb102f474ab86ddc412c724010d983927f (patch)
tree78041ec60acdde7dc5a0d3dbf75ec084a0569533 /sql-common
parent4bd55050adb67b35a4c15c327d06a52535811fe7 (diff)
parentc42892d61413adea81c174a90d458c07a8ddd52c (diff)
downloadmariadb-git-d3c4a5cb102f474ab86ddc412c724010d983927f.tar.gz
auto-merge
Diffstat (limited to 'sql-common')
-rw-r--r--sql-common/my_time.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sql-common/my_time.c b/sql-common/my_time.c
index 23532027883..155e0237e3c 100644
--- a/sql-common/my_time.c
+++ b/sql-common/my_time.c
@@ -762,19 +762,20 @@ long calc_daynr(uint year,uint month,uint day)
{
long delsum;
int temp;
+ int y= year; /* may be < 0 temporarily */
DBUG_ENTER("calc_daynr");
- if (year == 0 && month == 0 && day == 0)
+ if (y == 0 && month == 0 && day == 0)
DBUG_RETURN(0); /* Skip errors */
- delsum= (long) (365L * year+ 31*(month-1) +day);
+ delsum= (long) (365L * y+ 31*(month-1) +day);
if (month <= 2)
- year--;
+ y--;
else
delsum-= (long) (month*4+23)/10;
- temp=(int) ((year/100+1)*3)/4;
+ temp=(int) ((y/100+1)*3)/4;
DBUG_PRINT("exit",("year: %d month: %d day: %d -> daynr: %ld",
- year+(month <= 2),month,day,delsum+year/4-temp));
- DBUG_RETURN(delsum+(int) year/4-temp);
+ y+(month <= 2),month,day,delsum+y/4-temp));
+ DBUG_RETURN(delsum+(int) y/4-temp);
} /* calc_daynr */