~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Brian Aker
  • Date: 2011-02-22 06:12:02 UTC
  • mfrom: (2190.1.6 drizzle-build)
  • Revision ID: brian@tangent.org-20110222061202-k03czxykqy4x9hjs
List update, header fixes, multiple symbols, and David deletes some code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems
 
4
 *  Copyright (C) 2008 Sun Microsystems, Inc.
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
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/tztime.h"
24
 
#include "drizzled/temporal.h"
25
 
#include "drizzled/session.h"
 
22
#include <drizzled/function/time/curdate.h>
 
23
#include <drizzled/tztime.h>
 
24
#include <drizzled/temporal.h>
 
25
#include <drizzled/session.h>
 
26
#include <drizzled/current_session.h>
26
27
 
27
28
namespace drizzled
28
29
{
37
38
 
38
39
  /* We don't need to set second_part and neg because they already 0 */
39
40
  ltime.hour= ltime.minute= ltime.second= 0;
40
 
  ltime.time_type= DRIZZLE_TIMESTAMP_DATE;
 
41
  ltime.time_type= type::DRIZZLE_TIMESTAMP_DATE;
41
42
 
42
43
  /** 
43
44
   * @TODO Remove ltime completely when timezones are reworked.  Using this
49
50
}
50
51
 
51
52
/**
52
 
    Converts current time in time_t to DRIZZLE_TIME represenatation for local
 
53
    Converts current time in time_t to type::Time represenatation for local
53
54
    time zone. Defines time zone (local) used for whole CURDATE function.
54
55
*/
55
 
void Item_func_curdate_local::store_now_in_TIME(DRIZZLE_TIME *now_time)
 
56
void Item_func_curdate_local::store_now_in_TIME(type::Time *now_time)
56
57
{
57
58
  Session *session= current_session;
58
 
  time_t tmp= session->query_start();
 
59
  time_t tmp= session->getCurrentTimestampEpoch();
59
60
 
60
61
  (void) cached_temporal.from_time_t(tmp);
61
62
 
65
66
  now_time->hour= 0;
66
67
  now_time->minute= 0;
67
68
  now_time->second= 0;
 
69
  now_time->second_part= 0;
68
70
}
69
71
 
70
72
/**
71
 
    Converts current time in time_t to DRIZZLE_TIME represenatation for UTC
 
73
    Converts current time in time_t to type::Time represenatation for UTC
72
74
    time zone. Defines time zone (UTC) used for whole UTC_DATE function.
73
75
*/
74
 
void Item_func_curdate_utc::store_now_in_TIME(DRIZZLE_TIME *now_time)
 
76
void Item_func_curdate_utc::store_now_in_TIME(type::Time *now_time)
75
77
{
76
78
  Session *session= current_session;
77
 
  time_t tmp= session->query_start();
 
79
  time_t tmp= session->getCurrentTimestampEpoch();
78
80
 
79
81
  (void) cached_temporal.from_time_t(tmp);
80
82
 
84
86
  now_time->hour= 0;
85
87
  now_time->minute= 0;
86
88
  now_time->second= 0;
 
89
  now_time->second_part= 0;
87
90
}
88
91
 
89
92
bool Item_func_curdate::get_temporal(Date &to)