summaryrefslogtreecommitdiff
path: root/sql/field.cc
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2011-06-09 18:06:29 +0200
committerSergei Golubchik <sergii@pisem.net>2011-06-09 18:06:29 +0200
commitfdfeb4bea389f32fdc5fb493e3d003f9ed9d4713 (patch)
tree836f6e4adda3bf80bac1cee1c934990663381dbf /sql/field.cc
parentc3f665dc66d7ddb068875be9e78eb9b7a0d250e6 (diff)
downloadmariadb-git-fdfeb4bea389f32fdc5fb493e3d003f9ed9d4713.tar.gz
small optimization in Field_time_hires.
Fix Field_time_hires::reset()
Diffstat (limited to 'sql/field.cc')
-rw-r--r--sql/field.cc13
1 files changed, 8 insertions, 5 deletions
diff --git a/sql/field.cc b/sql/field.cc
index 884c424aaf7..f6b30b4dee3 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -5364,11 +5364,15 @@ void Field_time::sql_type(String &res) const
res.set_ascii(STRING_WITH_LEN("time"));
}
-static const longlong t_shift= ((TIME_MAX_VALUE_SECONDS+1)*TIME_SECOND_PART_FACTOR);
+int Field_time_hires::reset()
+{
+ store_bigendian(zero_point, ptr, Field_time_hires::pack_length());
+ return 0;
+}
+
void Field_time_hires::store_TIME(MYSQL_TIME *ltime)
{
- ulonglong packed= sec_part_shift(pack_time(ltime), dec) +
- sec_part_shift(t_shift, dec);
+ ulonglong packed= sec_part_shift(pack_time(ltime), dec) + zero_point;
store_bigendian(packed, ptr, Field_time_hires::pack_length());
}
@@ -5425,8 +5429,7 @@ bool Field_time_hires::get_date(MYSQL_TIME *ltime, uint fuzzydate)
uint32 len= pack_length();
longlong packed= read_bigendian(ptr, len);
- if (packed)
- packed= sec_part_unshift(packed - sec_part_shift(t_shift, dec), dec);
+ packed= sec_part_unshift(packed - zero_point, dec);
unpack_time(packed, ltime);
/*