1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2011 Matthew Rheaume
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; version 2 of the License.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22
#include <drizzled/function/time/curtime.h>
23
#include <drizzled/temporal.h>
24
#include <drizzled/session.h>
25
#include <drizzled/session/times.h>
26
#include <drizzled/current_session.h>
31
void Item_func_curtime::fix_length_and_dec()
33
collation.set(&my_charset_bin);
35
max_length=Time::MAX_STRING_LENGTH*MY_CHARSET_BIN_MB_MAXLEN;
37
store_now_in_TIME(<ime);
39
ltime.year= ltime.month= ltime.day= 0;
40
ltime.time_type = type::DRIZZLE_TIMESTAMP_TIME;
42
cached_temporal.set_hours(ltime.hour);
43
cached_temporal.set_minutes(ltime.minute);
44
cached_temporal.set_seconds(ltime.second);
47
void Item_func_curtime_local::store_now_in_TIME(type::Time *now_time)
49
(void) cached_temporal.from_time_t(current_session->times.getCurrentTimestampEpoch());
54
now_time->hour= cached_temporal.hours();
55
now_time->minute= cached_temporal.minutes();
56
now_time->second= cached_temporal.seconds();
59
void Item_func_curtime_utc::store_now_in_TIME(type::Time *now_time)
61
(void) cached_temporal.from_time_t(current_session->times.getCurrentTimestampEpoch());
66
now_time->hour= cached_temporal.hours();
67
now_time->minute= cached_temporal.minutes();
68
now_time->second= cached_temporal.seconds();
71
bool Item_func_curtime::get_temporal(Time &to)
77
bool Item_func_curtime::get_time(type::Time &res)
83
} /* namespace drizzled */