summaryrefslogtreecommitdiff
path: root/sql/field.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2018-03-30 14:29:23 +0400
committerAlexander Barkov <bar@mariadb.com>2018-03-30 14:29:23 +0400
commit556a9202cea398ac31a8ddde84faaf49c8aa77b7 (patch)
tree7c8f7f60a405832b52ffbe7202626b77494886b2 /sql/field.cc
parent17bbab5fb0ef9c55f2cec9f5ba79bb75dda4631a (diff)
downloadmariadb-git-556a9202cea398ac31a8ddde84faaf49c8aa77b7.tar.gz
Cleanup: moving timestamp_to_TIME() as a method to THD
Diffstat (limited to 'sql/field.cc')
-rw-r--r--sql/field.cc23
1 files changed, 2 insertions, 21 deletions
diff --git a/sql/field.cc b/sql/field.cc
index 9da65526e14..47af9a8b1f7 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -1819,30 +1819,11 @@ int Field::store(const char *to, size_t length, CHARSET_INFO *cs,
}
-static int timestamp_to_TIME(THD *thd, MYSQL_TIME *ltime, my_time_t ts,
- ulong sec_part, ulonglong fuzzydate)
-{
- thd->time_zone_used= 1;
- if (ts == 0 && sec_part == 0)
- {
- if (fuzzydate & TIME_NO_ZERO_DATE)
- return 1;
- set_zero_time(ltime, MYSQL_TIMESTAMP_DATETIME);
- }
- else
- {
- thd->variables.time_zone->gmt_sec_to_TIME(ltime, ts);
- ltime->second_part= sec_part;
- }
- return 0;
-}
-
-
int Field::store_timestamp(my_time_t ts, ulong sec_part)
{
MYSQL_TIME ltime;
THD *thd= get_thd();
- timestamp_to_TIME(thd, &ltime, ts, sec_part, 0);
+ thd->timestamp_to_TIME(&ltime, ts, sec_part, 0);
return store_time_dec(&ltime, decimals());
}
@@ -5316,7 +5297,7 @@ bool Field_timestamp::get_date(MYSQL_TIME *ltime, ulonglong fuzzydate)
{
ulong sec_part;
my_time_t ts= get_timestamp(&sec_part);
- return timestamp_to_TIME(get_thd(), ltime, ts, sec_part, fuzzydate);
+ return get_thd()->timestamp_to_TIME(ltime, ts, sec_part, fuzzydate);
}