summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2018-09-20 16:51:56 +0400
committerAlexander Barkov <bar@mariadb.com>2018-09-20 16:51:56 +0400
commit935a163dd9242457fe56e73b2c2932230579aef5 (patch)
treed2e9ce4e9aa8d62573675c46241cec9473889c64 /sql
parent0c6455aa4658790439a58956f05df200a5e380b8 (diff)
downloadmariadb-git-935a163dd9242457fe56e73b2c2932230579aef5.tar.gz
MDEV-17244 MAKETIME(900,0,0.111) returns a wrong result
Diffstat (limited to 'sql')
-rw-r--r--sql/item_timefunc.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index cc03cc004bd..2dc704f6873 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -2765,9 +2765,10 @@ bool Item_func_maketime::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date)
}
else
{
- ltime->hour= TIME_MAX_HOUR;
- ltime->minute= TIME_MAX_MINUTE;
- ltime->second= TIME_MAX_SECOND;
+ // use check_time_range() to set ltime to the max value depending on dec
+ int unused;
+ ltime->hour= TIME_MAX_HOUR + 1;
+ check_time_range(ltime, decimals, &unused);
char buf[28];
char *ptr= longlong10_to_str(hour.value(), buf, hour.is_unsigned() ? 10 : -10);
int len = (int)(ptr - buf) + sprintf(ptr, ":%02u:%02u", (uint)minute, (uint)second);