~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

Merge Monty - Updates to pandora-build to support features of gcc 4.5.

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
 
#include <drizzled/function/time/curdate.h>
23
 
#include <drizzled/temporal.h>
24
 
#include <drizzled/session.h>
25
 
#include <drizzled/session/times.h>
26
 
#include <drizzled/current_session.h>
 
22
#include "drizzled/function/time/curdate.h"
 
23
#include "drizzled/tztime.h"
 
24
#include "drizzled/temporal.h"
 
25
#include "drizzled/session.h"
27
26
 
28
27
namespace drizzled
29
28
{
38
37
 
39
38
  /* We don't need to set second_part and neg because they already 0 */
40
39
  ltime.hour= ltime.minute= ltime.second= 0;
41
 
  ltime.time_type= type::DRIZZLE_TIMESTAMP_DATE;
 
40
  ltime.time_type= DRIZZLE_TIMESTAMP_DATE;
42
41
 
43
42
  /** 
44
43
   * @TODO Remove ltime completely when timezones are reworked.  Using this
50
49
}
51
50
 
52
51
/**
53
 
    Converts current time in time_t to type::Time represenatation for local
 
52
    Converts current time in time_t to DRIZZLE_TIME represenatation for local
54
53
    time zone. Defines time zone (local) used for whole CURDATE function.
55
54
*/
56
 
void Item_func_curdate_local::store_now_in_TIME(type::Time *now_time)
 
55
void Item_func_curdate_local::store_now_in_TIME(DRIZZLE_TIME *now_time)
57
56
{
58
 
  (void) cached_temporal.from_time_t(current_session->times.getCurrentTimestampEpoch());
 
57
  Session *session= current_session;
 
58
  time_t tmp= session->query_start();
 
59
 
 
60
  (void) cached_temporal.from_time_t(tmp);
59
61
 
60
62
  now_time->year= cached_temporal.years();
61
63
  now_time->month= cached_temporal.months();
63
65
  now_time->hour= 0;
64
66
  now_time->minute= 0;
65
67
  now_time->second= 0;
66
 
  now_time->second_part= 0;
67
68
}
68
69
 
69
70
/**
70
 
    Converts current time in time_t to type::Time represenatation for UTC
 
71
    Converts current time in time_t to DRIZZLE_TIME represenatation for UTC
71
72
    time zone. Defines time zone (UTC) used for whole UTC_DATE function.
72
73
*/
73
 
void Item_func_curdate_utc::store_now_in_TIME(type::Time *now_time)
 
74
void Item_func_curdate_utc::store_now_in_TIME(DRIZZLE_TIME *now_time)
74
75
{
75
 
  (void) cached_temporal.from_time_t(current_session->times.getCurrentTimestampEpoch());
 
76
  Session *session= current_session;
 
77
  time_t tmp= session->query_start();
 
78
 
 
79
  (void) cached_temporal.from_time_t(tmp);
76
80
 
77
81
  now_time->year= cached_temporal.years();
78
82
  now_time->month= cached_temporal.months();
80
84
  now_time->hour= 0;
81
85
  now_time->minute= 0;
82
86
  now_time->second= 0;
83
 
  now_time->second_part= 0;
84
87
}
85
88
 
86
89
bool Item_func_curdate::get_temporal(Date &to)