summaryrefslogtreecommitdiff
path: root/sql/field.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2018-02-09 19:49:19 +0400
committerAlexander Barkov <bar@mariadb.org>2018-02-10 00:06:10 +0400
commite07451f71f3b4cd474b1fd8b3395a8cc1a844e1f (patch)
treeb6a57a502eae60e2c69b2ffa5492d3686043e335 /sql/field.cc
parent564891c5328c20089ba7d1ab450143a3abe3e0d9 (diff)
parentb0a92333c00f8facd20c55cf7a8dfaf896b7f24d (diff)
downloadmariadb-git-e07451f71f3b4cd474b1fd8b3395a8cc1a844e1f.tar.gz
Merge remote-tracking branch 'origin/10.0' into 10.1
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 9bc1fcbffe8..64c51677c0f 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -5788,6 +5788,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;
}