summaryrefslogtreecommitdiff
path: root/sql/field.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2018-02-11 00:23:17 +0100
committerSergei Golubchik <serg@mariadb.org>2018-02-11 13:47:16 +0100
commit49bcc82686c9c305d376183ba4f7bafcbab96bc3 (patch)
tree24321dfbc4350532990dcc60b8eec441b6b9ca00 /sql/field.cc
parent7ed01563842cef3a5f8fe13d8538cd766fb8fc7a (diff)
parentb88542681b884951308e49c99caa3435cb719f09 (diff)
downloadmariadb-git-49bcc82686c9c305d376183ba4f7bafcbab96bc3.tar.gz
Merge branch '10.1' into 10.2
Diffstat (limited to 'sql/field.cc')
-rw-r--r--sql/field.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/sql/field.cc b/sql/field.cc
index a635b344a31..60df918bd63 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -5811,6 +5811,13 @@ static void calc_datetime_days_diff(MYSQL_TIME *ltime, long days)
ltime->second) * 1000000LL +
ltime->second_part);
unpack_time(timediff, ltime);
+ /*
+ unpack_time() broke down hours into ltime members hour,day,month.
+ Mix them back to ltime->hour using the same factors
+ that pack_time()/unpack_time() use (i.e. 32 for month).
+ */
+ ltime->hour+= (ltime->month * 32 + ltime->day) * 24;
+ ltime->month= ltime->day= 0;
}
ltime->time_type= MYSQL_TIMESTAMP_TIME;
}