1
/* - mode: c++ c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2010 Brian Aker
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; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23
#include "drizzled/function/cast/time.h"
24
#include "drizzled/time_functions.h"
30
bool Time::get_date(DRIZZLE_TIME *ltime, uint32_t )
32
bool res= get_arg0_date(ltime, TIME_FUZZY_DATE);
33
ltime->hour= ltime->minute= ltime->second= ltime->second_part= 0;
34
ltime->time_type= DRIZZLE_TIMESTAMP_DATE;
39
bool Time::get_time(DRIZZLE_TIME *ltime)
41
memset(ltime, 0, sizeof(DRIZZLE_TIME));
42
return args[0]->null_value;
45
String *Time::val_str(String *str)
50
if (not get_arg0_date(<ime, TIME_FUZZY_DATE) && not str->alloc(MAX_DATE_STRING_REP_LENGTH))
52
make_time(<ime, str);
60
int64_t Time::val_int()
65
if ((null_value= args[0]->get_time(<ime)))
68
return TIME_to_uint64_t(<ime);
72
} // namespace function
73
} // namespace drizzled