summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2001-08-21 13:47:03 +0300
committerunknown <monty@hundin.mysql.fi>2001-08-21 13:47:03 +0300
commitf1f4bc465fd39632d4a1b5245c19bc4da90ec2b7 (patch)
tree45861fe85fa38d1d49bcf25e9f4a866b38ad93f7 /sql
parent8d982e7690275491fe71bafc917486d7f61ea12c (diff)
parent023cbef04c5bec28e939d5076c5f329ab7f3994f (diff)
downloadmariadb-git-f1f4bc465fd39632d4a1b5245c19bc4da90ec2b7.tar.gz
Merge work:/home/bk/mysql-4.0 into hundin.mysql.fi:/my/bk/mysql-4.0
Diffstat (limited to 'sql')
-rw-r--r--sql/time.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/sql/time.cc b/sql/time.cc
index e0b74fc9d25..d1e0aee0fa4 100644
--- a/sql/time.cc
+++ b/sql/time.cc
@@ -176,7 +176,9 @@ uint calc_week(TIME *l_time, bool with_year, bool sunday_first_day_of_week,
ulong first_daynr=calc_daynr(l_time->year,1,1);
uint weekday=calc_weekday(first_daynr,sunday_first_day_of_week);
*year=l_time->year;
- if (l_time->month == 1 && weekday >= 4 && l_time->day <= 7-weekday)
+ if (l_time->month == 1 && l_time->day <= 7-weekday &&
+ ((!sunday_first_day_of_week && weekday >= 4) ||
+ (sunday_first_day_of_week && weekday != 0)))
{
/* Last week of the previous year */
if (!with_year)
@@ -186,7 +188,8 @@ uint calc_week(TIME *l_time, bool with_year, bool sunday_first_day_of_week,
first_daynr-= (days=calc_days_in_year(*year));
weekday= (weekday + 53*7- days) % 7;
}
- if (weekday >= 4)
+ if ((sunday_first_day_of_week && weekday != 0) ||
+ (!sunday_first_day_of_week && weekday >= 4))
days= daynr - (first_daynr+ (7-weekday));
else
days= daynr - (first_daynr - weekday);