~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

Merged Nathan from lp:~nlws/drizzle/fix-string-c-ptr-overrun

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
#include <drizzled/server_includes.h>
21
21
#include CSTDINT_H
22
 
#include <drizzled/functions/time/sysdate_local.h>
 
22
#include <drizzled/function/time/sysdate_local.h>
23
23
#include <drizzled/tztime.h>
24
24
#include <drizzled/session.h>
25
25
 
26
26
/**
27
 
    Converts current time in my_time_t to DRIZZLE_TIME represenatation for local
 
27
    Converts current time in time_t to DRIZZLE_TIME represenatation for local
28
28
    time zone. Defines time zone (local) used for whole SYSDATE function.
29
29
*/
30
30
void Item_func_sysdate_local::store_now_in_TIME(DRIZZLE_TIME *now_time)
31
31
{
32
32
  Session *session= current_session;
33
 
  session->variables.time_zone->gmt_sec_to_TIME(now_time, (my_time_t) my_time(0));
 
33
  session->variables.time_zone->gmt_sec_to_TIME(now_time, time(NULL));
34
34
}
35
35
 
36
36
 
37
 
String *Item_func_sysdate_local::val_str(String *str __attribute__((unused)))
 
37
String *Item_func_sysdate_local::val_str(String *)
38
38
{
39
39
  assert(fixed == 1);
40
40
  store_now_in_TIME(&ltime);
68
68
 
69
69
 
70
70
bool Item_func_sysdate_local::get_date(DRIZZLE_TIME *res,
71
 
                                       uint32_t fuzzy_date __attribute__((unused)))
 
71
                                       uint32_t )
72
72
{
73
73
  store_now_in_TIME(&ltime);
74
74
  *res= ltime;
76
76
}
77
77
 
78
78
 
79
 
int Item_func_sysdate_local::save_in_field(Field *to, bool no_conversions __attribute__((unused)))
 
79
int Item_func_sysdate_local::save_in_field(Field *to, bool )
80
80
{
81
81
  store_now_in_TIME(&ltime);
82
82
  to->set_notnull();