1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008 Sun Microsystems, Inc.
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/sysdate_local.h>
23
#include <drizzled/tztime.h>
24
#include <drizzled/session.h>
30
Converts current time in time_t to type::Time represenatation for local
31
time zone. Defines time zone (local) used for whole SYSDATE function.
33
void Item_func_sysdate_local::store_now_in_TIME(type::Time &now_time)
35
getSession().variables.time_zone->gmt_sec_to_TIME(now_time, time(NULL));
39
String *Item_func_sysdate_local::val_str(String *)
42
store_now_in_TIME(ltime);
44
size_t length= type::Time::MAX_STRING_LENGTH;
45
ltime.convert(buff, length);
47
str_value.set(buff, length, &my_charset_bin);
53
int64_t Item_func_sysdate_local::val_int()
56
store_now_in_TIME(ltime);
63
double Item_func_sysdate_local::val_real()
67
store_now_in_TIME(ltime);
71
return int64_t2double(tmp);
75
void Item_func_sysdate_local::fix_length_and_dec()
78
collation.set(&my_charset_bin);
79
max_length= DateTime::MAX_STRING_LENGTH*MY_CHARSET_BIN_MB_MAXLEN;
83
bool Item_func_sysdate_local::get_date(type::Time &res, uint32_t )
85
store_now_in_TIME(ltime);
91
int Item_func_sysdate_local::save_in_field(Field *to, bool )
93
store_now_in_TIME(ltime);
95
to->store_time(ltime, type::DRIZZLE_TIMESTAMP_DATETIME);
100
} /* namespace drizzled */