~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Brian Aker
  • Date: 2011-01-25 07:22:15 UTC
  • mfrom: (2109.1.7 drizzle-build)
  • Revision ID: brian@tangent.org-20110125072215-567z6uzy5vdvn4va
Merge in build/timestamp patches/fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
    Converts current time in time_t to type::Time represenatation for local
31
31
    time zone. Defines time zone (local) used for whole SYSDATE function.
32
32
*/
33
 
void Item_func_sysdate_local::store_now_in_TIME(type::Time *now_time)
 
33
void Item_func_sysdate_local::store_now_in_TIME(type::Time &now_time)
34
34
{
35
35
  Session *session= current_session;
36
36
  session->variables.time_zone->gmt_sec_to_TIME(now_time, time(NULL));
40
40
String *Item_func_sysdate_local::val_str(String *)
41
41
{
42
42
  assert(fixed == 1);
43
 
  store_now_in_TIME(&ltime);
 
43
  store_now_in_TIME(ltime);
44
44
 
45
45
  size_t length= type::Time::MAX_STRING_LENGTH;
46
46
  ltime.convert(buff, length);
54
54
int64_t Item_func_sysdate_local::val_int()
55
55
{
56
56
  assert(fixed == 1);
57
 
  store_now_in_TIME(&ltime);
 
57
  store_now_in_TIME(ltime);
58
58
  int64_t tmp;
59
59
  ltime.convert(tmp);
60
60
 
65
65
{
66
66
  assert(fixed == 1);
67
67
 
68
 
  store_now_in_TIME(&ltime);
 
68
  store_now_in_TIME(ltime);
69
69
  int64_t tmp;
70
70
  ltime.convert(tmp);
71
71
 
81
81
}
82
82
 
83
83
 
84
 
bool Item_func_sysdate_local::get_date(type::Time *res, uint32_t )
 
84
bool Item_func_sysdate_local::get_date(type::Time &res, uint32_t )
85
85
{
86
 
  store_now_in_TIME(&ltime);
87
 
  *res= ltime;
 
86
  store_now_in_TIME(ltime);
 
87
  res= ltime;
88
88
  return 0;
89
89
}
90
90
 
91
91
 
92
92
int Item_func_sysdate_local::save_in_field(Field *to, bool )
93
93
{
94
 
  store_now_in_TIME(&ltime);
 
94
  store_now_in_TIME(ltime);
95
95
  to->set_notnull();
96
 
  to->store_time(&ltime, type::DRIZZLE_TIMESTAMP_DATETIME);
 
96
  to->store_time(ltime, type::DRIZZLE_TIMESTAMP_DATETIME);
97
97
 
98
98
  return 0;
99
99
}