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
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
20
#include <drizzled/server_includes.h>
22
#include <drizzled/functions/time/sysdate_local.h>
23
#include <drizzled/tztime.h>
27
Converts current time in my_time_t to DRIZZLE_TIME represenatation for local
28
time zone. Defines time zone (local) used for whole SYSDATE function.
30
void Item_func_sysdate_local::store_now_in_TIME(DRIZZLE_TIME *now_time)
32
Session *session= current_session;
33
session->variables.time_zone->gmt_sec_to_TIME(now_time, (my_time_t) my_time(0));
34
session->time_zone_used= 1;
38
String *Item_func_sysdate_local::val_str(String *str __attribute__((unused)))
41
store_now_in_TIME(<ime);
42
buff_length= (uint) my_datetime_to_str(<ime, buff);
43
str_value.set(buff, buff_length, &my_charset_bin);
48
int64_t Item_func_sysdate_local::val_int()
51
store_now_in_TIME(<ime);
52
return (int64_t) TIME_to_uint64_t_datetime(<ime);
55
double Item_func_sysdate_local::val_real()
58
store_now_in_TIME(<ime);
59
return uint64_t2double(TIME_to_uint64_t_datetime(<ime));
63
void Item_func_sysdate_local::fix_length_and_dec()
66
collation.set(&my_charset_bin);
67
max_length= MAX_DATETIME_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
71
bool Item_func_sysdate_local::get_date(DRIZZLE_TIME *res,
72
uint32_t fuzzy_date __attribute__((unused)))
74
store_now_in_TIME(<ime);
80
int Item_func_sysdate_local::save_in_field(Field *to, bool no_conversions __attribute__((unused)))
82
store_now_in_TIME(<ime);
84
to->store_time(<ime, DRIZZLE_TIMESTAMP_DATETIME);