~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Lee Bieber
  • Date: 2011-01-24 17:20:08 UTC
  • mfrom: (2107.2.1 trunk-bug-703913)
  • mto: This revision was merged to the branch mainline in revision 2109.
  • Revision ID: kalebral@gmail.com-20110124172008-y5maihyoyu7gn18p
Merge Andrew - fix bug 703913: some support-files should be dropped

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>
 
20
#include "config.h"
21
21
 
22
22
#include <drizzled/function/time/now.h>
23
 
#include <drizzled/current_session.h>
24
23
#include <drizzled/session.h>
25
24
 
26
 
#include <drizzled/temporal.h>
 
25
#include "drizzled/temporal.h"
27
26
 
28
27
namespace drizzled
29
28
{
46
45
 
47
46
  ltime.time_type= type::DRIZZLE_TIMESTAMP_DATETIME;
48
47
 
49
 
  store_now_in_TIME(ltime);
 
48
  store_now_in_TIME(&ltime);
50
49
 
51
50
  ltime.convert(value);
52
51
 
60
59
    Converts current time in time_t to type::Time represenatation for local
61
60
    time zone. Defines time zone (local) used for whole NOW function.
62
61
*/
63
 
void Item_func_now_local::store_now_in_TIME(type::Time &now_time)
 
62
void Item_func_now_local::store_now_in_TIME(type::Time *now_time)
64
63
{
65
64
  Session *session= current_session;
66
65
  uint32_t fractional_seconds= 0;
69
68
#if 0
70
69
  now_time->store(tmp, fractional_seconds, true);
71
70
#endif
72
 
  now_time.store(tmp, fractional_seconds);
 
71
  now_time->store(tmp, fractional_seconds);
73
72
}
74
73
 
75
74
 
77
76
    Converts current time in time_t to type::Time represenatation for UTC
78
77
    time zone. Defines time zone (UTC) used for whole UTC_TIMESTAMP function.
79
78
*/
80
 
void Item_func_now_utc::store_now_in_TIME(type::Time &now_time)
 
79
void Item_func_now_utc::store_now_in_TIME(type::Time *now_time)
81
80
{
82
81
  Session *session= current_session;
83
82
  uint32_t fractional_seconds= 0;
84
83
  time_t tmp= session->getCurrentTimestampEpoch(fractional_seconds);
85
84
 
86
 
  now_time.store(tmp, fractional_seconds);
 
85
  now_time->store(tmp, fractional_seconds);
87
86
}
88
87
 
89
88
bool Item_func_now::get_temporal(DateTime &to)
92
91
  return true;
93
92
}
94
93
 
95
 
bool Item_func_now::get_date(type::Time &res, uint32_t )
 
94
bool Item_func_now::get_date(type::Time *res, uint32_t )
96
95
{
97
 
  res= ltime;
 
96
  *res= ltime;
98
97
  return 0;
99
98
}
100
99
 
102
101
int Item_func_now::save_in_field(Field *to, bool )
103
102
{
104
103
  to->set_notnull();
105
 
  return to->store_time(ltime, type::DRIZZLE_TIMESTAMP_DATETIME);
 
104
  return to->store_time(&ltime, type::DRIZZLE_TIMESTAMP_DATETIME);
106
105
}
107
106
 
108
107
} /* namespace drizzled */