~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/functions/time/sysdate_local.cc

move functions from item.cc/item.h to item directory

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#include "config.h"
21
 
 
22
 
#include <drizzled/function/time/sysdate_local.h>
 
20
#include <drizzled/server_includes.h>
 
21
#include CSTDINT_H
 
22
#include <drizzled/functions/time/sysdate_local.h>
23
23
#include <drizzled/tztime.h>
24
24
#include <drizzled/session.h>
25
25
 
26
 
namespace drizzled
27
 
{
28
 
 
29
26
/**
30
 
    Converts current time in time_t to DRIZZLE_TIME represenatation for local
 
27
    Converts current time in my_time_t to DRIZZLE_TIME represenatation for local
31
28
    time zone. Defines time zone (local) used for whole SYSDATE function.
32
29
*/
33
30
void Item_func_sysdate_local::store_now_in_TIME(DRIZZLE_TIME *now_time)
34
31
{
35
32
  Session *session= current_session;
36
 
  session->variables.time_zone->gmt_sec_to_TIME(now_time, time(NULL));
 
33
  session->variables.time_zone->gmt_sec_to_TIME(now_time, (my_time_t) my_time(0));
37
34
}
38
35
 
39
36
 
40
 
String *Item_func_sysdate_local::val_str(String *)
 
37
String *Item_func_sysdate_local::val_str(String *str __attribute__((unused)))
41
38
{
42
39
  assert(fixed == 1);
43
40
  store_now_in_TIME(&ltime);
66
63
{
67
64
  decimals= 0;
68
65
  collation.set(&my_charset_bin);
69
 
  max_length= DateTime::MAX_STRING_LENGTH*MY_CHARSET_BIN_MB_MAXLEN;
 
66
  max_length= MAX_DATETIME_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
70
67
}
71
68
 
72
69
 
73
70
bool Item_func_sysdate_local::get_date(DRIZZLE_TIME *res,
74
 
                                       uint32_t )
 
71
                                       uint32_t fuzzy_date __attribute__((unused)))
75
72
{
76
73
  store_now_in_TIME(&ltime);
77
74
  *res= ltime;
79
76
}
80
77
 
81
78
 
82
 
int Item_func_sysdate_local::save_in_field(Field *to, bool )
 
79
int Item_func_sysdate_local::save_in_field(Field *to, bool no_conversions __attribute__((unused)))
83
80
{
84
81
  store_now_in_TIME(&ltime);
85
82
  to->set_notnull();
87
84
  return 0;
88
85
}
89
86
 
90
 
} /* namespace drizzled */