summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorAlexander Nozdrin <alik@sun.com>2010-08-31 17:47:10 +0400
committerAlexander Nozdrin <alik@sun.com>2010-08-31 17:47:10 +0400
commit02890f0b9082e41b32122e1ef3beb45872eb3b0b (patch)
tree12e5815763f949e034a3ab3c8af80db85f456775 /sql
parente924c91e57846821d0a1a6d786ddbef412565f7f (diff)
downloadmariadb-git-02890f0b9082e41b32122e1ef3beb45872eb3b0b.tar.gz
Cherry-pick patch for Bug#56120 from mysql-5.5-bugfixing.
Diffstat (limited to 'sql')
-rw-r--r--sql/item.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/sql/item.cc b/sql/item.cc
index 24f57342668..427146e11dc 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -7510,9 +7510,14 @@ String *Item_cache_datetime::val_str(String *str)
return NULL;
if (cached_field_type == MYSQL_TYPE_TIME)
{
- ulonglong time= int_value;
- DBUG_ASSERT(time <= TIME_MAX_VALUE);
+ longlong time= int_value;
set_zero_time(&ltime, MYSQL_TIMESTAMP_TIME);
+ if (time < 0)
+ {
+ time= -time;
+ ltime.neg= TRUE;
+ }
+ DBUG_ASSERT(time <= TIME_MAX_VALUE);
ltime.second= time % 100;
time/= 100;
ltime.minute= time % 100;