~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Brian Aker
  • Date: 2010-08-12 17:19:46 UTC
  • mfrom: (1701.1.1 turn-off-csv)
  • Revision ID: brian@tangent.org-20100812171946-n44naaqhg27gehlh
MErge Monty, remove CSV from auto-build

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, Inc.
 
4
 *  Copyright (C) 2008 Sun Microsystems
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>
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
57
  Session *session= current_session;
59
 
  time_t tmp= session->getCurrentTimestampEpoch();
 
58
  time_t tmp= session->query_start();
60
59
 
61
60
  (void) cached_temporal.from_time_t(tmp);
62
61
 
66
65
  now_time->hour= 0;
67
66
  now_time->minute= 0;
68
67
  now_time->second= 0;
69
 
  now_time->second_part= 0;
70
68
}
71
69
 
72
70
/**
73
 
    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
74
72
    time zone. Defines time zone (UTC) used for whole UTC_DATE function.
75
73
*/
76
 
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)
77
75
{
78
76
  Session *session= current_session;
79
 
  time_t tmp= session->getCurrentTimestampEpoch();
 
77
  time_t tmp= session->query_start();
80
78
 
81
79
  (void) cached_temporal.from_time_t(tmp);
82
80
 
86
84
  now_time->hour= 0;
87
85
  now_time->minute= 0;
88
86
  now_time->second= 0;
89
 
  now_time->second_part= 0;
90
87
}
91
88
 
92
89
bool Item_func_curdate::get_temporal(Date &to)