summaryrefslogtreecommitdiff
path: root/sql-common
diff options
context:
space:
mode:
authorGuilhem Bichot <guilhem@mysql.com>2009-02-12 15:08:56 +0100
committerGuilhem Bichot <guilhem@mysql.com>2009-02-12 15:08:56 +0100
commit704b4845aa9ce51a6c5a9f5f42265e376db0dfb3 (patch)
tree73476f970c229f75846855edeeddfbc6fd87ed4b /sql-common
parent2637dda66845868fe996e60e54996acf03f6c537 (diff)
parenta5e5b0180a6b86cce258eef232ef59d6e7c40bb0 (diff)
downloadmariadb-git-704b4845aa9ce51a6c5a9f5f42265e376db0dfb3.tar.gz
merge of 5.1-main into 5.1-maria. Myisam->Maria change propagation will follow.
There were so many changes into mtr (this is the new mtr coming) that I rather copied mtr from 6.0-main here (at least this one knows how to run Maria tests). I also fixed suite/maria tests to be accepted by the new mtr. mysys/thr_mutex.c: adding DBUG_PRINT here, so that we can locate where the warning is issued.
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 */