~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/microtime.cc

  • Committer: pcrews
  • Date: 2011-05-24 17:36:24 UTC
  • mfrom: (1099.4.232 drizzle)
  • Revision ID: pcrews@lucid32-20110524173624-mwr1bvq6fa1r01ao
Updated translations + 2011.05.18 tarball tag

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
19
 */
20
20
 
21
 
#include "config.h"
 
21
#include <config.h>
22
22
#include <boost/lexical_cast.hpp>
23
23
#include <drizzled/field/microtime.h>
24
24
#include <drizzled/error.h>
25
 
#include <drizzled/tztime.h>
26
25
#include <drizzled/table.h>
27
26
#include <drizzled/session.h>
28
 
 
29
 
#include <math.h>
30
 
 
 
27
#include <drizzled/session/times.h>
 
28
#include <drizzled/current_session.h>
 
29
#include <drizzled/temporal.h>
 
30
#include <cmath>
31
31
#include <sstream>
32
 
 
33
32
#include <boost/date_time/posix_time/posix_time.hpp>
34
33
 
35
 
#include "drizzled/temporal.h"
36
 
 
37
 
namespace drizzled
38
 
{
39
 
 
40
 
namespace field
41
 
{
 
34
 
 
35
namespace drizzled {
 
36
namespace field {
42
37
 
43
38
static boost::posix_time::ptime _epoch(boost::gregorian::date(1970, 1, 1));
44
39
 
66
61
 
67
62
int Microtime::store(const char *from,
68
63
                     uint32_t len,
69
 
                     const CHARSET_INFO * const )
 
64
                     const charset_info_st * const )
70
65
{
71
66
  MicroTimestamp temporal;
72
67
 
157
152
  return 0;
158
153
}
159
154
 
160
 
double Microtime::val_real(void)
 
155
double Microtime::val_real(void) const
161
156
{
162
157
  uint64_t temp;
163
158
  type::Time::usec_t micro_temp;
179
174
  return result;
180
175
}
181
176
 
182
 
type::Decimal *Microtime::val_decimal(type::Decimal *decimal_value)
 
177
type::Decimal *Microtime::val_decimal(type::Decimal *decimal_value) const
183
178
{
184
179
  type::Time ltime;
185
180
 
188
183
  return date2_class_decimal(&ltime, decimal_value);
189
184
}
190
185
 
191
 
int64_t Microtime::val_int(void)
 
186
int64_t Microtime::val_int(void) const
192
187
{
193
188
  uint64_t temp;
194
189
 
206
201
  return result;
207
202
}
208
203
 
209
 
String *Microtime::val_str(String *val_buffer, String *)
 
204
String *Microtime::val_str(String *val_buffer, String *) const
210
205
{
211
206
  uint64_t temp= 0;
212
207
  type::Time::usec_t micro_temp= 0;
223
218
  return val_buffer;
224
219
}
225
220
 
226
 
bool Microtime::get_date(type::Time &ltime, uint32_t)
 
221
bool Microtime::get_date(type::Time &ltime, uint32_t) const
227
222
{
228
223
  uint64_t temp;
229
224
  uint32_t micro_temp= 0;
238
233
  return false;
239
234
}
240
235
 
241
 
bool Microtime::get_time(type::Time &ltime)
 
236
bool Microtime::get_time(type::Time &ltime) const
242
237
{
243
238
  return Microtime::get_date(ltime, 0);
244
239
}
286
281
  Session *session= getTable() ? getTable()->in_use : current_session;
287
282
 
288
283
  type::Time::usec_t fractional_seconds= 0;
289
 
  uint64_t epoch_seconds= session->getCurrentTimestampEpoch(fractional_seconds);
 
284
  uint64_t epoch_seconds= session->times.getCurrentTimestampEpoch(fractional_seconds);
290
285
 
291
286
  set_notnull();
292
287
  pack_num(epoch_seconds);
293
288
  pack_num(fractional_seconds, ptr +8);
294
289
}
295
290
 
296
 
long Microtime::get_timestamp(bool *null_value)
 
291
long Microtime::get_timestamp(bool *null_value) const
297
292
{
298
293
  if ((*null_value= is_null()))
299
294
    return 0;