diff options
author | Michael Widenius <monty@askmonty.org> | 2011-05-02 20:58:45 +0300 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2011-05-02 20:58:45 +0300 |
commit | e415ba0fb2c57eaf370e84a3a9c8d831f820a560 (patch) | |
tree | f113a8024de4ee4f1bc19aae98c19a2835f5b4e7 /sql-common | |
parent | 046418ad956c98c3788d79650fcb50479844df3b (diff) | |
parent | a1f7ceb281f9d87c9baea125ebab26f99a0370f8 (diff) | |
download | mariadb-git-e415ba0fb2c57eaf370e84a3a9c8d831f820a560.tar.gz |
Merge with MySQL 5.1.57/58
Moved some BSD string functions from Unireg
Diffstat (limited to 'sql-common')
-rw-r--r-- | sql-common/my_time.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sql-common/my_time.c b/sql-common/my_time.c index 0408ea1e11f..03a124a341a 100644 --- a/sql-common/my_time.c +++ b/sql-common/my_time.c @@ -775,7 +775,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); @@ -786,6 +786,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 */ @@ -995,7 +996,7 @@ my_system_gmt_sec(const MYSQL_TIME *t_src, long *my_timezone, with unsigned time_t tmp+= shift*86400L might result in a number, larger then TIMESTAMP_MAX_VALUE, so another check will work. */ - if ((tmp < TIMESTAMP_MIN_VALUE) || (tmp > TIMESTAMP_MAX_VALUE)) + if (!IS_TIME_T_VALID_FOR_TIMESTAMP(tmp)) tmp= 0; return (my_time_t) tmp; |