~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Jay Pipes
  • Date: 2009-02-28 20:43:31 UTC
  • mto: (910.2.6 mordred-noatomics)
  • mto: This revision was merged to the branch mainline in revision 912.
  • Revision ID: jpipes@serialcoder-20090228204331-6x804cdbfzyy9w8i
Merged in remove-timezone work

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
 
 
 
20
#include <drizzled/server_includes.h>
 
21
#include CSTDINT_H
22
22
#include <drizzled/function/time/now.h>
 
23
#include <drizzled/tztime.h>
23
24
#include <drizzled/session.h>
24
25
 
25
 
#include "drizzled/temporal.h"
26
 
 
27
 
namespace drizzled
28
 
{
29
 
 
30
26
String *Item_func_now::val_str(String *)
31
27
{
32
28
  assert(fixed == 1);
58
54
void Item_func_now_local::store_now_in_TIME(DRIZZLE_TIME *now_time)
59
55
{
60
56
  Session *session= current_session;
61
 
  time_t tmp= session->query_start();
62
 
 
63
 
  (void) cached_temporal.from_time_t(tmp);
64
 
 
65
 
  now_time->year= cached_temporal.years();
66
 
  now_time->month= cached_temporal.months();
67
 
  now_time->day= cached_temporal.days();
68
 
  now_time->hour= cached_temporal.hours();
69
 
  now_time->minute= cached_temporal.minutes();
70
 
  now_time->second= cached_temporal.seconds();
 
57
  session->variables.time_zone->gmt_sec_to_TIME(now_time,
 
58
                                                (time_t)session->query_start());
71
59
}
72
60
 
73
61
 
77
65
*/
78
66
void Item_func_now_utc::store_now_in_TIME(DRIZZLE_TIME *now_time)
79
67
{
80
 
  Session *session= current_session;
81
 
  time_t tmp= session->query_start();
82
 
 
83
 
  (void) cached_temporal.from_time_t(tmp);
84
 
 
85
 
  now_time->year= cached_temporal.years();
86
 
  now_time->month= cached_temporal.months();
87
 
  now_time->day= cached_temporal.days();
88
 
  now_time->hour= cached_temporal.hours();
89
 
  now_time->minute= cached_temporal.minutes();
90
 
  now_time->second= cached_temporal.seconds();
91
 
}
92
 
 
93
 
bool Item_func_now::get_temporal(DateTime &to)
94
 
{
95
 
  to= cached_temporal;
96
 
  return true;
 
68
  my_tz_UTC->gmt_sec_to_TIME(now_time,
 
69
                             (time_t)(current_session->query_start()));
 
70
  /*
 
71
    We are not flagging this query as using time zone, since it uses fixed
 
72
    UTC-SYSTEM time-zone.
 
73
  */
97
74
}
98
75
 
99
76
bool Item_func_now::get_date(DRIZZLE_TIME *res,
110
87
  return to->store_time(&ltime, DRIZZLE_TIMESTAMP_DATETIME);
111
88
}
112
89
 
113
 
} /* namespace drizzled */